0

I have around 300 polygons spread across a large area and wish to create a set of points, one for each polygon, that represents the maximum elevation value along the edge (or within) the polygon.

I tried this in ArcGIS Pro with a 10m resolution DEM, but the results weren't good enough (see below). I have the 1m resolution DEM for the whole country loaded in GEE, but have only added points as centroids to polygons before, and am not sure how to approach this in GEE. I have seen examples how to make a table of the max elevation using zonal statistics, but I don't know how to go from there to a point.

enter image description here

Here is an example script with a DEM and some polygons:

https://code.earthengine.google.com/bf8f8e77e7ca5d53f6c0a14f45c30ca8


var DEM = ee.Image("CGIAR/SRTM90_V4")
var VisParam = {"opacity":1,"bands":["elevation"],"min":-1,"max":3021,"palette":["4731ff","5ee1ff","41ff47","f3ff35","ff3925"]};

Map.addLayer (DEM, VisParam, 'DEM')```


1 Answer 1

1

Add a latitude and longitude band to the elevation image. Use a max reducer with numInputs=3 so it will find the max elevation but also return the corresponding lat/lon. Map over the results to turn the lat/lon values into points.

var bands = DEM.addBands(ee.Image.pixelLonLat())
var points = bands
    .reduceRegions({
      collection: geometries, 
      reducer: ee.Reducer.max(3).setOutputs(bands.bandNames()),
      scale: 1
    })
    .aside(print)
    .map(function(f) {
      return f.setGeometry(
        ee.Geometry.Point(ee.List([f.get('longitude'), f.get('latitude')])))
    })

https://code.earthengine.google.com/392bee8dec82d6e6eca3008bd9967428

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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