Aller au contenu principal

Extract Raster by Geometry

Overview

Use a vector geometry, such as a square or diamond, as a mask to spatially filter the input raster. Cells inside the mask are retained, and cells outside the mask are set to NoData.

Use Cases

  • Area-of-interest clipping: extract elevation data for a city or watershed from a national DEM.
  • Preprocessing for thematic analysis: keep only imagery cells inside a planning boundary for land-use change analysis.
  • Ecological and environmental monitoring: extract NDVI values within a wetland for statistics.
  • Map production: remove data outside the area of interest for clearer layout and display.
  • Pre-clipping before downsampling: avoid processing unnecessary large-area data and improve efficiency.

Parameters

ParameterDescriptionNotes
Input raster fileSource raster file to extract fromSupports single-band or multiband formats. It should use the same coordinate system as the specified center coordinates. If not, project the data first.
Geometry typeCircle, diamond, sector, and other geometry types
Center coordinates and radiusCenter X/Y coordinates plus radius, angle, and other parameters for the selected geometry typeUnits must match the spatial reference of the input raster, such as meters or degrees. Choose values based on the actual analysis extent.
Other settingsAdditional extraction options
Clip: when selected, the output raster extent equals the geometry extent and the physical file is clipped. When not selected, the output keeps the full extent of the original raster, but cells outside the geometry are set to NoData, which can keep the output file size close to the original raster.
Invert: when selected, cells outside the geometry are retained and cells inside are set to NoData.
Touch: when selected, cells that intersect the geometry in any way are retained.
Fill edge: expands the area around the geometry before clipping. This is often used to add a buffer around the clipping area to avoid edge effects.
Fill widthExtended fill width for the extracted geometry raster
Output pathTarget directory for the result rasterEnsure that the directory exists and is writable. Avoid Chinese characters and special symbols in the path for better cross-platform compatibility.
Output file nameFull result raster file name, including extensionThe extension determines the output format, such as .tif for GeoTIFF or .img for ERDAS IMG.

Steps

  1. Start the tool

    Open Spatial Analysis Tools > Extraction Analysis, then double-click Extract Raster by Geometry to start the tool pane.

  2. Select the input raster file

    • Input raster file: enter dem.tif.
  3. Select the geometry type

    • Geometry type: select Sector.
  4. Set geometry parameters

    • X coordinate and Y coordinate: enter 578327.55413 and 3068124.259846.
    • Start angle: enter 45 degrees; End angle: enter 135 degrees.
    • Radius: enter 2000.
  5. Configure other settings

    Leave all options cleared.

  6. Set fill width

    Set Fill width to 0.

  7. Specify the output location

    • Output path: set the output to User Space/Toolbox/Spatial Analysis Tools.
    • Output file name: enter regularpolygon.tif.
  8. Run the tool

    • Click Run at the bottom of the pane and wait until the task list reports that the tool has succeeded.

Notes

  • Coordinate system consistency: the input raster and geometry mask should use the same coordinate system. If they differ, project the data first to avoid misalignment.
  • Boundary cell handling: when the mask boundary does not align with the cell grid, some cells may be partially covered. Decide whether those cells should be retained.
  • NoData handling: the output NoData value affects later calculations, such as excluding NoData when calculating means.
  • Cell value preservation: this tool does not change cell values or resolution and does not resample. Resample after clipping if a different resolution is required.
  • Boundary smoothing: some workflows may need buffering or smoothing around the mask boundary to avoid jagged clipping edges.