Use this example to create your contour maps
Step 1: import the srtm digital elevation data.
Step 2: Create a geometry on your map
Step 3: use the code below to create contour lines.
var lines = ee.List.sequence(0, 4000, 200)
var contourlines = lines.map(function(line) {
var mycontour = srtm
.convolve(ee.Kernel.gaussian(5, 3))
.subtract(ee.Image.constant(line)).zeroCrossing()
.multiply(ee.Image.constant(line)).toFloat();
return mycontour.mask(mycontour);
})
contourlines = ee.ImageCollection(contourlines).mosaic()
Map.addLayer(contourlines, {min: 0, max: 5000, palette:['00ff00', 'ff0000']}, 'contours')
Map.centerObject(geometry,5)
See an example here.
Great article. Would it also be possible to create polygon contours instead of lines?
LikeLike