HOW TO

Clip a hole in a raster based on a shapefile

Last Published: April 25, 2020

Summary

Instructions provided show how to clip a hole in a raster based on the shape of a shapefile.

Procedure

Spatial Analyst is required for this procedure.

  1. Create a new integer field in the polygon shapefile that is used to clip the hole in the raster.
  2. Calculate this field = 1.
  3. Convert this shapefile to a raster using Spatial Analyst toolbar > Convert > Features to Raster.
  4. Specify the field previously created for 'Field'.
  5. Specify the same cell size as the underlying raster and specify an output raster.
  6. The polygon is rasterized, such as Poly_Raster. 'Poly_Raster' needs to be the same extent as the other raster. Go to ArcToolbox > Spatial Analyst Tools > Map Algebra > Single Output Map Algebra.
  7. Copy the following statement into this tool, changing the path to the raster previously created:

    CON(ISNULL(C:\Data\'Poly_Raster'), 0, (C:\Data\'Poly_Raster'))

  8. Click 'Environments' at the bottom of this tool. Expand 'General Settings'.
  9. Scroll down to 'Extent' and specify this as the underlying larger raster.
  10. Click OK > specify an output raster > click OK to run the tool. The output raster, such as Poly_Raster_2 is the same size as the underlying raster. The extended extent of Poly_Raster_2 has pixel values of 0. Use this raster to clip the polygon shape from the original raster.
  11. Go to ArcToolbox > Spatial Analyst Tools > Conditional > Set Null.
  12. Specify 'Poly_Raster_2' for Input Conditional Raster.
  13. Specify the raster dataset that is clipped (original raster) for Input False Raster or Constant Value.
  14. Specify an output raster.
  15. For the expression, type 'Value = 1'.

  16. Click OK to run the tool. This tool returns values of the original raster where 'Poly_Raster_2' does not equal zero, and returns 'NoDATA' where it does.

Article ID:000009465

Software:
  • ArcMap 9 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic