How To: Clip a raster using the Clipping Geometry option


Instructions provided describe how to call the Clip tool in Python when a feature class or template raster is used as clipping geometry.
From ArcGIS 9.3, the Clip (management) tool allows a template feature class or raster dataset to be specified as the extent for clipping.
However, because the 'rectangle' parameter of this tool is required, when the tool is called in Python, a value must be specified, even though the tool uses the extent of the clipping feature. The correctness of the extent does not matter when the clipping feature is used.


In ArcGIS 9.3 and 9.3.1, any rectangle can be specified in the Clip tool when a template is specified. The tool uses the extent of the template.
Starting in ArcGIS 10.0, if the ArcPy Python package is used, write "#" for the 'rectangle' parameter, instead of assigning a placeholder extent.
Depending on the Python package, select the appropriate script below.

  • For the arcgisscripting package:
    ##Clip Raster Dataset with feature geometry
    import arcgisscripting
    gp = arcgisscripting.create()
    gp.Clip_management("c:/image.tif", "0 0 1 1", "c:/clip.tif","c:/feature.shp", "0", "ClippingGeometry")
  • For the ArcPy package:
    ##Clip Raster Dataset with feature geometry
    import arcpy
    arcpy.Clip_management("c:/image.tif", "#", "c:/clip.tif","c:/feature.shp", "0", "ClippingGeometry")

Related Information

Last Published: 11/6/2020

Article ID: 000011116

Software: ArcMap 10.8.1, 10.8, 10.7.1, 10.7, 10.6.1, 10.6, 10.5.1, 10.5, 10.4.1, 10.4, 10.3.1, 10.3, 10.2.2, 10.2.1, 10.2, 10.1, 10