Clip Raster (Data Management)

Summary

Cuts out a portion of a raster dataset, mosaic dataset, or image service layer.

Illustration

Clip Raster tool illustration

Usage

  • This tool allows you to extract a portion of a raster dataset based on a template extent. The clip output includes any pixels that intersect the template extent. To extract a portion of a feature dataset, use the Clip tool in the Analysis toolbox.

  • The clipped area is specified either by a rectangular envelope using minimum and maximum x- and y-coordinates or by using an output extent file. If the clip extent specified is not aligned with the input raster dataset, this tool verifies that the proper alignment is used. This may cause the output to have a slightly different extent than specified in the tool.

  • An existing raster or vector layer can be used as the clip extent. If you are using a feature class as the output extent, you can clip the raster by the minimum bounding rectangle of the feature class or by the polygon geometry of the features. If clipping geometry is used, the pixel depth of the output may be promoted. Ensure that the output format can support the proper pixel depth.

  • You can also use the selected features within the display as the clipping extent. If a feature in the feature class is selected and the Use Input Features for Clipping Geometry parameter is checked, the output clips out the selected areas. If a feature in the feature class is selected but the Use Input Features for Clipping Geometry parameter is not checked, the output clips out the minimum bounding rectangle for that feature.

  • You can interactively draw a polygon on the raster in the map to be used as the clipping extent. Click the Create new features in the current map to use as input drop-down list and click Polygon. Then move the pointer to the map to digitize a polygon. Double-click to complete the clipping polygon.

    Note:

    The only option available for clipping a raster layer is Polygon.

  • You can save the output to BIL, BIP, BMP, BSQ, DAT, Esri Grid, GIF, IMG, JPEG, JPEG 2000, PNG, TIFF, MRF, or CRF format, or any geodatabase raster dataset.

  • The extent values must be in the same spatial coordinates and units as the raster dataset.

  • This tool supports multidimensional raster data. To run the tool on each slice in the multidimensional raster and generate a multidimensional raster output, be sure to save the output to CRF.

    Supported input multidimensional dataset types include multidimensional raster layer, mosaic dataset, image service, and CRF.

Parameters

LabelExplanationData Type
Input Raster

The raster dataset, mosaic dataset, or image service to be clipped.

Mosaic Dataset; Mosaic Layer; Raster Dataset; Raster Layer
Rectangle

The four coordinates that define the extent of the bounding box that will be used to clip the raster.

If the Output Extent parameter is set, it will automatically populate the x-min, y-min, x-max, and y-max values. Use the Reset button Refresh to reset the rectangle extent to the extent of the input raster dataset.

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

Envelope; Feature Class; Feature Layer
Output Raster Dataset

The name, location, and format of the dataset being created. Ensure that it can support the necessary bit depth.

When storing the raster dataset in a file format, specify the file extension as follows:

  • .bilEsri BIL
  • .bipEsri BIP
  • .bmp—BMP
  • .bsqEsri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • .mrf—MRF
  • .crf—CRF
  • No extension for Esri Grid

When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset.

When storing a raster dataset to a JPEG format file, a JPEG 2000 format file, a TIFF format file, or a geodatabase, you can specify Compression Type and Compression Quality values in the geoprocessing environments.

Raster Dataset
Output Extent
(Optional)

A raster dataset or feature class that will be used as the extent. The clip output includes 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, check the Use Input Features for Clipping Geometry parameter. When this parameter is checked, the pixel depth of the output may be promoted. Ensure that the output format can support the proper pixel depth.

Raster Layer; Feature Layer
NoData Value
(Optional)

The value for pixels to be considered as NoData.

String
Use Input Features for Clipping Geometry
(Optional)

Specifies whether the minimum bounding rectangle or the geometry of the specified feature class will be used to clip the data.

  • Checked—The geometry of the specified feature class will be used to clip the data. The pixel depth of the output may be increased; ensure that the output format can support the proper pixel depth.
  • Unchecked—The minimum bounding rectangle will be used to clip the data. This is the default.

Boolean
Maintain Clipping Extent
(Optional)

Specifies the extent that will be used in the clipping output.

  • Checked—The number of columns and rows will be adjusted and the pixels will be resampled to exactly match the clipping extent specified.
  • Unchecked—The cell alignment of the input raster will be maintained and the output extent will be adjusted accordingly. This is the default.

Boolean

arcpy.management.Clip(in_raster, rectangle, out_raster, {in_template_dataset}, {nodata_value}, {clipping_geometry}, {maintain_clipping_extent})
NameExplanationData Type
in_raster

The raster dataset, mosaic dataset, or image service to be clipped.

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

The four coordinates that define the extent of the bounding box that will be used to clip the raster. Coordinates are expressed in the order of x-min, y-min, x-max, y-max.

If the in_template_dataset parameter is set, it will automatically set this parameter. If the in_template_dataset parameter is a feature layer, the clipping extent is extracted from the bounding box. In this case, the rectangle parameter can be left empty as long as the in_template_dataset parameter value is specified.

If both the rectangle and in_template_dataset parameters are set, the rectangle parameter value will be used.

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

Envelope; Feature Class; Feature Layer
out_raster

The name, location, and format of the dataset being created. Ensure that it can support the necessary bit depth.

When storing the raster dataset in a file format, specify the file extension as follows:

  • .bilEsri BIL
  • .bipEsri BIP
  • .bmp—BMP
  • .bsqEsri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • .mrf—MRF
  • .crf—CRF
  • No extension for Esri Grid

When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset.

When storing a raster dataset to a JPEG format file, a JPEG 2000 format file, a TIFF format file, or a geodatabase, you can specify Compression Type and Compression Quality values in the geoprocessing environments.

Raster Dataset
in_template_dataset
(Optional)

A raster dataset or feature class that will be used as the extent. The clip output includes 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, set the clipping_geometry parameter to ClippingGeometry. This option may promote the pixel depth of the output. Ensure that the output format can support the proper pixel depth.

Raster Layer; Feature Layer
nodata_value
(Optional)

The value for pixels to be considered as NoData.

String
clipping_geometry
(Optional)

Specifies whether the minimum bounding rectangle or the geometry of the specified feature class will be used to clip the data.

  • NONEThe minimum bounding rectangle will be used to clip the data. This is the default.
  • ClippingGeometryThe geometry of the specified feature class will be used to clip the data. The pixel depth of the output may be increased; ensure that the output format can support the proper pixel depth.
Boolean
maintain_clipping_extent
(Optional)

Specifies the extent that will be used in the clipping output.

  • MAINTAIN_EXTENTThe number of columns and rows will be adjusted and the pixels will be resampled to exactly match the clipping extent specified.
  • NO_MAINTAIN_EXTENTThe cell alignment of the input raster will be maintained and the output extent will be adjusted accordingly. This is the default.
Boolean

Code sample

Clip example 1 (Python window)

This is a Python sample for the Clip function.

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 function.

##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")
Clip example 3 (stand-alone script)

This is a Python script sample for the Clip function using the clipping_geometry parameter.

##Clip while maintaining original extent



import arcpy

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



arcpy.Clip_management("c:\\test\\image.tif", "2536996.21761925 7365614.23930381 2537634.12209192 7366302.3861673", 
                      "c:\\output\\clip.tif", "c:\\test\\clipfeature.shp", "0", "ClippingGeometry", 
                      "MAINTAIN_EXTENT")

Related topics