Aller au contenu principal

Clip Raster by Vector

Purpose

Use vector geometry, such as points, lines, or polygons, to clip raster data. Cell values inside the geometry are retained, and areas outside the geometry are set to NoData. This tool is commonly used to extract a study area or split data by administrative boundary.

Use Cases

  1. Area extraction: Extract data for a province, county, or other target area from a large raster, such as a national DEM.
  2. Mask processing: Use a protected-area boundary as a mask to extract vegetation index, land-use, or other raster data inside the boundary.
  3. Data alignment: Align the output to a specific geometry boundary during clipping to support later spatial analysis.

Parameters

ParameterDescriptionNotes
Input raster fileThe raster dataset to be clipped. Common formats such as .tif, .dem, and .img are supported.The input can be a single-band or multiband raster.
Input vector fileThe vector file used for clipping. Formats such as .shp, .geojson, .pgv, and .gpv are supported.The vector data provides the clip geometry or mask.
Clip to extentChecked: clips to the bounding rectangle, or extent, of the vector geometry.
Unchecked: clips exactly by the vector geometry shape, such as a circle or polygon. Areas outside the geometry but inside the extent are filled with NoData.
Align to geometry boundaryChecked: adjusts the output raster columns and rows so the cell grid fully matches the specified clip range.
Unchecked: keeps the same cell alignment as the input raster.
Include all touched pixelsChecked (all_touched): a cell is treated as inside the range if any part of the cell touches the geometry boundary.
Unchecked: a cell is retained only when its center point is inside the geometry.
Controls how boundary cells are included.
Output fileSpecifies the storage location, file name, data format, data type, and NoData value of the output raster data.See Common raster output.

Steps

  1. Start the tool: Open the Raster Basic Tools toolbox, go to Raster Processing, and open the Clip Raster by Vector tool pane.
  2. Set the inputs: In Input file settings, select the Input raster file to process and specify the Input vector file used for clipping.
  3. Configure parameters: In Clip parameter settings, configure the options as needed.
  4. Configure the output: In Output file settings, set the storage path and name of the Output raster file.
  5. Run the tool: Click Run and inspect the result.

Clip Option Examples

The original data includes one raster dataset and one polygon vector dataset.

Default Option: Clip to Polygon

The black area represents the clipped raster data.

Clip to Extent

The black area represents the clipped raster data, and the blue-yellow-green gradient represents the original raster data.

Align to Geometry Boundary

Aligning to the geometry boundary means aligning to the extent of the polygon feature. In this case, the cell size is adjusted slightly to fit the boundary. In the properties shown on the right, the original cell size changes from 100 to 100.11878.

In the example, the black area is the clipped raster data, and the green area represents invalid values in the clipped raster data.

Notes

  • Automatic coordinate system conversion: If the vector and raster coordinate systems are different, the tool automatically converts the vector geometry to the raster coordinate system before clipping.
  • NoData handling: Cells outside the clipped area are assigned the NoData value defined by the input raster. If the input raster does not define one, the default invalid value for the data type is usually used.
  • Resampling impact: When Align to geometry boundary is enabled, cell resampling may be involved. The default resampling method is nearest neighbor.