1

I have the following script that reclassifies rasters and then combines them into one. I am trying to clip the final raster to a shapefile I have. All my research shows that I need to clip it to the extents of the shapefile (called a rectangle). My script is as follows;

import arcpy
from arcpy import env  
from arcpy.sa import *

env.workspace = "C:\\Data"

arcpy.CheckOutExtension("Spatial")

outReclass1 = Reclassify("stream", "VALUE",
                     RemapValue([[1,0], ["NoData",1]]))
outReclass1.save("C:\\Data\\reclassStream")

outReclass2 = Reclassify("pond", "VALUE",
                     RemapValue([[1,0], ["NoData",1]]))
outReclass2.save("C:\\Data\\reclassPond")

outReclass3 = Reclassify("landuse", "VALUE",
                     RemapValue([[1,1], [2,2], [3,3], [4,4]]))
outReclass3.save("C:\\Data\\reclassLandUse")

outReclass4 = Reclassify("soils", "VALUE",
                     RemapValue([[1,3,1], [3,6,2], [6,9,3], [9,12,4], [12,15,5]]))
outReclass4.save("C:\\Data\\reclassSoils")

finalRaster = outReclass1 * outReclass2 * outReclass3 * outReclass4
finalRaster.save("C:\\Data\\riskarea")

arcpy.CheckInExtension("Spatial")

arcpy.Clip_management("riskarea", "440677.437, 4331200, 611070.062, 611070.062", "riskarea_clipped")

I am getting the following error;

line 30, in <module>
    arcpy.Clip_management("riskarea", "440677.437, 4331200, 611070.062, 611070.062", "riskarea_clipped")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.6\ArcPy\arcpy\management.py", line 15884, in Clip
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Rectangle: Dataset 440677.437, 4331200, 611070.062, 611070.062 does not exist or is not supported
ERROR 000472: Name of single band grid cannot have more than 13 characters
Failed to execute (Clip).
  • 1
    Do you really mean to be using Grid format?? GeoTIFF is there for the asking by adding a ".tif" suffix. Then you won't be constrained by the 16 character INFO name limitation that requires base names to not exceed 13 characters. – Vince Oct 27 '18 at 4:02
2

Your X-Maximum, Y-Maximum values are the same so you are not providing a valid rectangle. Recheck the bounding extent of your area and try again. http://desktop.arcgis.com/en/arcmap/10.3/tools/data-management-toolbox/clip.htm

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy