Get stats of an area
Step 1: Display the srtm using the code below.
// import srtm dem var srtm = ee.Image("USGS/SRTMGL1_003"); // mask areas less than 0 srtm = srtm.mask(srtm.gt(0)); // add layer to map Map.addLayer(srtm,{min:??,max:??,palette:"??????"});
Step 2: Find the min max using the inspector.
Step 3: draw a geometry
Step 4: calculate the min max using the code below
var minMax = srtm.reduceRegion(ee.Reducer.minMax(),geometry); print(minMax);
I have cooldn’t worked the code. Map.addLayer(srtm,{min:??,max:??,palette:”??????”}); there is a mistake about ? it say, thanks
LikeLike
var geometry = ee.Geometry.Polygon(
[[[44.06596982940921, 39.86569840255777],
[44.06596982940921, 39.51909356184006],
[44.57134092315921, 39.51909356184006],
[44.57134092315921, 39.86569840255777]]]);
// import srtm dem
var srtm = ee.Image(“USGS/SRTMGL1_003”);
// mask areas less than 0
srtm = srtm.mask(srtm.gt(0));
// add layer to map
Map.addLayer(srtm,{min:0,max:8000});
var minMax = srtm.reduceRegion(ee.Reducer.minMax(),geometry);
print(minMax);
LikeLike