HOW TO

Clip a raster using the Clipping Geometry option

Last Published: November 6, 2020

Summary

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.

Procedure

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")

Article ID:000011116

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic