TransWikia.com

Selecting only part of slope image and then converting it into polygon using Google Earth Engine

Geographic Information Systems Asked by Alessandro Bartesaghi on December 29, 2020

I have computed as an EE example the slope map.

 var srtm = ee.Image('CGIAR/SRTM90_V4');
    var sIm = ee.Terrain.slope(srtm);
    Map.addLayer(slope);

Now I want to take only the area with slope <5% and transform it into a polygon. How can I do? I tried like this but it doesn’t work.

var fcArea = ee.Geometry.Polygon([[
[9.784130646592173,46.11176966991991],
[9.977764679795298,46.11176966991991],
[9.977764679795298,46.31323245639384],
[9.784130646592173,46.31323245639384]
]]);
var srtm = ee.Image('CGIAR/SRTM90_V4');
var sIm = ee.Terrain.slope(srtm);
//
var sStart =sIm.eq(0);
var sInt = sStart
.add(sIm.eq(1))
.add(sIm.eq(2))
.add(sIm.eq(3))
.add(sIm.eq(4))
.add(sIm.eq(5))
;
var sSlope = sInt.updateMask(sInt.gt(0));
var vSlope = sSlope.reduceToVectors({
  geometry: fcArea,
  geometryType: 'polygon'
});
print (vSlope, 'vSlope');
Map.addLayer(vSlope,{color: 'FF4500'},'SLOPE <5%');

One Answer

You are probably looking for .lt(5):

var sLt5 =sIm.lt(5);
var sSlope = sLt5.selfMask();
var vSlope = sSlope.reduceToVectors({
  geometry: fcArea,
  geometryType: 'polygon'
});

Answered by Kuik on December 29, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP