Seems clipping a raster to a polygon should be straightforward. I have a raster, I have individual polygon feature layers selected from a feature class. The polygons are rectangles. Same projection. I want to loop through it in Python ultimately, but I have tried both via Python and in the GUI - same result. Note that even using a feature layer with one feature and not setting clipping_geometry to NONE, the results are identical. Here is my code:
arcpy.Clip_management(r'path/to/raster(an adf)',"", 'ras_name_out', 'feature_lyr_from_TOC', "#","ClippingGeometry","NO_MAINTAIN_EXTENT")
The final argument/parameter is optional and the documentation (https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/clip.htm ) states this:
- NO_MAINTAIN_EXTENT—The cell alignment of the input raster will be maintained and the output extent will be adjusted accordingly.
Yet my output raster has clearly been resampled. Pixels are slightly shifted, the pixel value range (DEM) changed.
FYI - I am trimming excess NaN values from existing raster datasets.
I don't understand why NO_MANTAIN_EXTENT is resampling. Should be simple. If this data were given to me as non-proprietary data type like a GeoTiff I could have easily batch processed these in GDAL. Should be simple.