0

I have a set of points(lat, lon and other attributes) stored as an Asset in Google Earth Engine. I import this asset as a Feature Collection and visualize the points over Satellite Imagery in Google Earth Engine. I would like to generate a heat map from these points.

I searched extensively over the web, but could not find any resource elaborating on doing this in Google Earth Engine. I did come across this documentation https://developers.google.com/maps/documentation/javascript/examples/layer-heatmap of the Google Maps JS API that uses |google.maps.visualization.HeatmapLayer|.

Is there an equivalent of this in Google Earth Engine?

0

There is not a heatmap function that I know of in Earth Engine but you can create your own using some neighborhood operations that are available in EE. Here is an example:

// 'fc' is the feature collection of points
var points = fc.map(function(feature){
  return feature.set('dummy',1);
});

function heatmap(fc,radius){
  var ptImg = points.reduceToImage(['dummy'],ee.Reducer.first()).unmask(0);
  var kernel = ee.Kernel.circle(radius);
  var result = ptImg.convolve(kernel);
  return result.updateMask(result.neq(0));
}

var heatmapImg = heatmap(points,20);

var gradient = ['lightgreen','yellow','red'];

Map.addLayer(heatmapImg,{palette:gradient,min:0,max:0.02},'Heatmap');

And here is the link. I hope this helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.