1

I am trying to clip about 36 rasters by a polygon. However, I am running into an error. It isn't a coding problem with the loop because I receive the same error when I run the function on a single raster. Here is my code:

# Import system modules
import arcpy
import os

# Set environment settings
arcpy.env.workspace = r"H:\GIS Project\reprojected_rasters" #The file where your files are
arcpy.env.overwriteOutput = True
outWorkspace = r"H:\GIS Project\clipped_rasters" #where you want the new rasters to go
arcpy.env.parallelProcessingFactor = "50"
clipping_shp = r"H:\GIS Project\large AF dataset\point_feature_class\clipping.shp"
rasters = arcpy.ListRasters("*","TIF")
print rasters

arcpy.Clip_management ("SND_100_200_EV_N_P_AU_NAT_C_20140801.tif", "131.183300 -37.714100 152.250000 -16.056200", r"H:\GIS Project\clipped_rasters" , clipping_shp, "ClippingGeometry" , "NO_MAINTAIN_EXTENT")

print "Clipped Script ran ok"

However, when I try to run this code, I receive the following error:

Traceback (most recent call last):
  File "<module2>", line 21, in <module>
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\management.py", line 13594, in Clip
    raise e
ExecuteError: ERROR 000622: Failed to execute (Clip). Parameters are not valid.
ERROR 000800: The value is not a member of ClippingGeometry | NONE.

Here is some information about my data:

  • all are .tif files
  • all are projected into the same datum (GDA 1994 Australian Albers)
  • The clipping polygon was made from using the minimum extent function of a point feature class
  • Is clipping.shp in geographical coordinates? Are your rasters geographical coordinates? Are all the spatial references defined? Your code looks reasonable, the only thing I can think of is that a geographical extent doesn't agree with a projected dataset; as the extent "131.183300,-37.714100,152.250000,-16.056200" isn't specified in any CRS it may disagree with the CRS of the shapefile or raster. – Michael Stimson Jun 27 '18 at 5:06
  • Yes clipping.shp and all rasters are in GDA 1994. I retrieved the extent from the arcgis desktop in layer properties under source. – Douglas Jun 27 '18 at 5:17
  • 1
    Is the error happening during the first iteration in your for loop? If so, then you can reduce your code snippet by eliminating that loop. The less code you have and present in a code snippet the more likely it is that you or a potential answerer will spot what is astray. – PolyGeo Jun 27 '18 at 5:28
  • If it's the extent of the layer can you try arcpy.Clip_management(inrl,arcpy.Describe(clipping_shp).extent,... as an extent object resources.arcgis.com/en/help/main/10.2/index.html#//… instead of a string; it shouldn't matter but I find a numeric list is less prone to cause errors. – Michael Stimson Jun 27 '18 at 5:34
  • Sadly, this did not work. I have another error now. I have posted the new error in the question – Douglas Jun 27 '18 at 7:45
0

You are going to laugh at that but if you replace the commas with whitespaces in your rectangle extent string and if you add missing argument for nodata_value, it should work, e.g.,:

arcpy.Clip_management (inrl, "131.183300 -37.714100 152.250000 -16.056200", outrl, clipping_shp, nodata_value="0" "ClippingGeometry" , "NO_MAINTAIN_EXTENT")

  • Sadly, this did not work. I have another error now. I have posted the new error in the question – Douglas Jun 27 '18 at 7:45

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.