Clip (Data Management)

License Level:BasicStandardAdvanced

Summary

Creates a spatial subset of a raster, including a raster dataset, mosaic dataset, or image service layer.

Illustration

Clip illustration

Usage

Syntax

Clip_management (in_raster, rectangle, out_raster, {in_template_dataset}, {nodata_value}, {clipping_geometry}, {maintain_clipping_extent})
ParameterExplanationData Type
in_raster

The input raster dataset.

Mosaic Dataset; Mosaic Layer; Raster Dataset; Raster Layer
rectangle

The four coordinates defining the minimum bounding rectangle to be clipped are defined in this order: X-Minimum, Y-Minimum, X-Maximum, Y-Maximum.

If the clip extent specified is not aligned with the input raster dataset, the Clip tool makes sure that the proper alignment is used. This may cause the output to have a slightly different extent than specified in the tool.

Envelope
out_raster

The output raster dataset. Make sure that this output format is able to support the proper pixel depth.

When storing the raster dataset in a file format, you need to specify the file extension:

  • .bil—Esri BIL
  • .bip—Esri BIP
  • .bmp—BMP
  • .bsq—Esri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • no extension for Esri Grid

When storing a raster dataset in a geodatabase, no file extension should be added to the name of the raster dataset.

When storing your raster dataset to a JPEG file, a JPEG 2000 file, a TIFF file, or a geodatabase, you can specify a compression type and compression quality.

Raster Dataset
in_template_dataset
(Optional)

An existing raster or vector layer that can be used as the clip extent. The clip output includes any pixels that intersect the minimum bounding rectangle.

If a feature class is used as the output extent and you want to clip the raster based on the polygon features, use the clipping_geometry option. If this is checked, then the pixel depth of the output may be promoted. Therefore, you need to make sure that the output format can support the proper pixel depth.

Raster Layer; Feature Layer
nodata_value
(Optional)

All the pixels with the specified value will be set to NoData in the output raster dataset.

String
clipping_geometry
(Optional)

If you are using a feature class as the output extent, you have the option to clip the raster by the extent of the feature class or by its polygon perimeter.

  • NONEThe raster dataset is clipped based on the minimum bounding rectangle of the feature class.
  • ClippingGeometryThe raster dataset is clipped based on the perimeter of the polygon shape.

If clipping geometry is used, then the pixel depth of the output may be promoted. Therefore, you need to make sure that the output format can support the proper pixel depth.

Boolean
maintain_clipping_extent
(Optional)

Choose the extent for the clipped output raster dataset.

  • NO_MAINTAIN_EXTENTThe output raster will maintain the same cell alignment as the input raster, and the output extent will be adjusted accordingly. This is the default.
  • MAINTAIN_EXTENTThe output extent will exactly match the clipping extent specified, and the number of rows and columns will be adjusted accordingly. Since the number of rows and columns are adjusted to fit the output, the input values will be resampled.
Boolean

Code Sample

Clip example 1 (Python window)

This is a Python sample for the Clip tool.

import arcpy
arcpy.Clip_management(
    "c:/data/image.tif","1952602 294196 1953546 296176",
    "c:/data/clip.gdb/clip01", "#", "#", "NONE", "NO_MAINTAIN_EXTENT")
Clip example 2 (stand-alone script)

This is a Python script sample for the Clip tool.

##Clip Raster Dataset by known extent - Left Bottom Right Top

import arcpy
arcpy.env.workspace = "C:/Workspace"
    

arcpy.Clip_management(
    "image.tif","1952602.23 294196.279 1953546.23 296176.279",
    "clip.gdb/clip", "#", "#", "NONE")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015