Select to view content in your preferred language

Clip USGS 3DEM: how to read the raster in Python for ArcGIS Pro

386
1
01-30-2019 12:57 PM
Sue-yingZhang
New Contributor

I want to clip the elevation data (3DEM) downloaded from USGS website. The raster-clip tool "Clip (data management)" in the Arcgis Pro works very well. However, I cannot clip it using the python function "arcpy.Clip_management()" .

The error report that the raster file is not exist or not support. I have tried different ways to read it, such as:

~grdn39w075.tif/Band_1 This is used by the Clip tool in Arcgis Pro ~grdn39w075.tif_Band_1 ~grdn39w075/Band_1

None of them can read the 3DEM file successfully.

Please let me know if you have any solutions. Thanks.

Python code:

in_raster= "~/Elevation/Tiles/grdn42w075.tif/Band_1"for i in range(0,9): buffer = shp_list[i] out_id=num_buffer=re.findall('\d+', shp_list[i]) out_path="C:/Users/zhangx24/Desktop/LUR_DM/GIS/Elevation/n42w75/" arcpy.Clip_management(in_raster,buffer,"n42w75_"+ out_id[1],"~/Documents/ArcGIS/Projects/LUR/LUR.gdb","99999","ClippingGeometry", "MAINTAIN_EXTENT")
0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

You path is a bit convoluted and long, it is preferable to save rasters as a *.tif file in a folder,  have you tried that?

0 Kudos