It seems I cannot clip my raster using the ArcGIS Python API. I am trying to read the Elevation Imagery Layer from the ArcGIS Living Atlas and clip it by a Watershed area. I first imported the USGS 3DEP Elevation - 30 m :
DEM_item = gis.content.get('0383ba18906149e3bd2a0975a0afdb8e')
DEM_Layer = DEM_item.layers[0]
DEM_Layer.properties.spatialReference
Then I imported Watershed Boundary Dataset HUC 10s:
watersheds_item = gis.content.get('42f868d269784624b0a2df9757c34abb')
HUC10 = watersheds_item.layers[0]
target_huc = '1807010201'
fs = HUC10.query(where=f"HUC10 = '{target_huc}'", out_fields="*", return_geometry=True, out_sr=DEM_Layer.properties.spatialReference)
Next, I changed the extent of the DEM_Layer to the extent of my watershed:
watershed_geometry = fs.features[0].geometry
from arcgis.geometry import Geometry
G = Geometry(watershed_geometry)
G.extent
anExtent = {
"xmin": -1949116.0903125,
"ymin": -436621.808186337,
"xmax": -1907601.63363431,
"ymax": -410136.939220854,
"spatialReference": {
"wkid": 102008,
"latestWkid": 102008
}
}
DEM_Layer.extent = anExtent
However, when I am trying to clip my raster, there is no output, and when I add the clipped raster to a map, nothing shows:
from arcgis.raster.functions import apply, clip, remap, colormap
watershed_clip = clip(raster=DEM_Layer, geometry= G)
watershed_clip

