Interpolation from vector to raster in Earth Engine creates an Image
from a FeatureCollection
. Specifically, Earth Engine uses numeric data
stored in a property of the features to interpolate values at new locations outside
of the features. The interpolation results in a continuous Image
of
interpolated values up to the distance specified.
Inverse Distance Weighted Interpolation
The inverse distance weighting (IDW) function in Earth Engine is based on the method
described by
Basso
et al. (1999). An additional control parameter is added in the form of a
decay factor (gamma
) on the inverse distance. Other parameters include the
mean and standard deviation of the property to interpolate and the maximum range
distance over which to interpolate. The following example creates an interpolated
surface of PM 2.5
concentrations from a FeatureCollection
of points representing PM 2.5
measurement stations.
// Load a Fusion Table corresponding to mean annual PM2.5 concentrations at points. var airQualityMeasurements = ee.FeatureCollection('ft:14BLob4jGA6au2MB1cx0GhxYDvZc-lVLAWhqBAZuN'); Map.addLayer(airQualityMeasurements, {}, 'Mean annual PM2.5 concentrations (micrograms/m^3)'); // This is the name of the property to interpolate. var propertyToInterpolate = 'ArithmeticMean'; // Combine mean and SD reducers for efficiency. var combinedReducer = ee.Reducer.mean().combine({ reducer2: ee.Reducer.stdDev(), sharedInputs: true }); // Estimate global mean and standard deviation (SD) from the points. var stats = airQualityMeasurements.reduceColumns({ reducer: combinedReducer, selectors: [propertyToInterpolate] }); // Do the interpolation, valid to 50 kilometers. var interpolatedPM25 = airQualityMeasurements.inverseDistance({ range: 50 * 1000, propertyName: propertyToInterpolate, mean: stats.get('mean'), stdDev: stats.get('stdDev'), gamma: 0.5 }); // Visualize the resulting interpolated raster. var vis = {min: 0, max: 15, palette: ['blue', 'green', 'red']}; Map.setCenter(-121.7944, 36.9235, 7); Map.addLayer(interpolatedPM25, vis, 'Interpolated PM2.5 concentration');
Note that, as specified by the range
parameter, the interpolation only
exists up to 50 kilometers from the nearest measurement station.
Kriging
Kriging is an interpolation method that uses a modeled estimate of semi-variance to create an image of interpolated values that is an optimal combination of the values at known locations. The Kriging estimator requires parameters that describe the shape of a semi-variogram fit to the known data points. These parameters are illustrated by Figure 1.

nugget
, sill
and range
parameters illustrated on a idealized variogram function.
The following example samples a sea surface temperature (SST) image at random locations, then interpolates SST from the sample using Kriging:
// Load an image of sea surface temperature (SST). var sst = ee.Image('NOAA/AVHRR_Pathfinder_V52_L3/20120802025048') .select('sea_surface_temperature') .rename('sst') .divide(100); // Define a geometry in which to sample points var geometry = ee.Geometry.Rectangle([-65.60, 31.75, -52.18, 43.12]); // Sample the SST image at 1000 random locations. var samples = sst.addBands(ee.Image.pixelLonLat()) .sample({region: geometry, numPixels: 1000}) .map(function(sample) { var lat = sample.get('latitude'); var lon = sample.get('longitude'); var sst = sample.get('sst'); return ee.Feature(ee.Geometry.Point([lon, lat]), {sst: sst}); }); // Interpolate SST from the sampled points. var interpolated = samples.kriging({ propertyName: 'sst', shape: 'exponential', range: 100 * 1000, sill: 1.0, nugget: 0.1, maxDistance: 100 * 1000, reducer: 'mean', }); var colors = ['00007F', '0000FF', '0074FF', '0DFFEA', '8CFF41', 'FFDD00', 'FF3700', 'C30000', '790000']; var vis = {min:-3, max:40, palette: colors}; Map.setCenter(-60.029, 36.457, 5); Map.addLayer(interpolated, vis, 'Interpolated'); Map.addLayer(sst, vis, 'Raw SST'); Map.addLayer(samples, {}, 'Samples', false);
The size of the neighborhood in which to perform the interpolation is specified by the
maxDistance
parameter. Larger sizes will result in smoother output but
slower computations.