I tried to convert the tree cover to a polygon in google earth engine by python api.
and I used these codes:
dataset = ee.Image('CGIAR/SRTM90_V4')
elevation = dataset.select('elevation')
slope = ee.Terrain.slope(elevation)
slope1 = slope.where(slope.lte(200), 1)
tree_vectors = slope1.reduceToVectors(
geometry=roi,
crs=slope1.projection(),
scale=40,
geometryType='polygon',
eightConnected=True,
labelProperty='zone',
maxPixels=1e12
)
but it raised this error:
EEException("Image.reduceToVectors: First band ('slope') of image must be integral.")
how can if fix it:
Try:
slope_int = slope.multiply(100).int()