1

I have an reclassify a slope in the, and I have points(ee_kaski) with lat,lng . I want to extract value of the reclassify slope value where this points lies on it. I have tried this using Python API.

My code is:

Map = geemap.Map(center=(28.2622,84.0167), zoom=12)
location = "users/landsatpractise/Kaski"
ee_kaski = ee.FeatureCollection(location)
#dem image
image = ee.Image("USGS/SRTMGL1_003")
slopesmrt = ee.Terrain.slope(image).clip(ee_kaski)
slopereclass = ee.Image(1) \
          .where(slopesmrt.gt(0).And(slopesmrt.lte(7)), 9) \
          .where(slopesmrt.gt(7).And(slopesmrt.lte(15)), 6) \
          .where(slopesmrt.gt(15).And(slopesmrt.lte(22)), 4)
SlpopeViz = {'palette': ['ecd3f5', 'bf72db','a333cc','4a0463']}
Map.addLayer(slopesmrt,SlpopeViz)
#fire_data
fire_data = ee.FeatureCollection("users/landsatpractise/fire_location_required")
Map.addLayer(fire_data)

Map enter image description here

1 Answer 1

1

There are 2 functions for extracting data from an ee.Image, one is for individual geometries and the other for many geometries at the same time (feature collection). What you need is the latter.

fire_data_extracted = slopereclass.reduceRegions(
    collection=fire_data,
    reducer=ee.Reducer.first(),
    scale=30
)
# see some results
print(fire_data_extracted.limit(5).getInfo())

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.