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
| Parameter | Description | Notes |
|---|---|---|
| Input raster file | Source raster file to extract from | Supports single-band or multiband formats. It should use the same coordinate system as the specified center coordinates. If not, project the data first. |
| Geometry type | Circle, diamond, sector, and other geometry types | |
| Center coordinates and radius | Center X/Y coordinates plus radius, angle, and other parameters for the selected geometry type | Units must match the spatial reference of the input raster, such as meters or degrees. Choose values based on the actual analysis extent. |
| Other settings | Additional 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 width | Extended fill width for the extracted geometry raster | |
| Output path | Target directory for the result raster | Ensure that the directory exists and is writable. Avoid Chinese characters and special symbols in the path for better cross-platform compatibility. |
| Output file name | Full result raster file name, including extension | The extension determines the output format, such as .tif for GeoTIFF or .img for ERDAS IMG. |
Steps
-
Start the tool
Open Spatial Analysis Tools > Extraction Analysis, then double-click Extract Raster by Geometry to start the tool pane.
-
Select the input raster file
- Input raster file: enter
dem.tif.
- Input raster file: enter
-
Select the geometry type
- Geometry type: select Sector.
-
Set geometry parameters
- X coordinate and Y coordinate: enter
578327.55413and3068124.259846. - Start angle: enter
45degrees; End angle: enter135degrees. - Radius: enter
2000.
- X coordinate and Y coordinate: enter
-
Configure other settings
Leave all options cleared.
-
Set fill width
Set Fill width to
0. -
Specify the output location
- Output path: set the output to
User Space/Toolbox/Spatial Analysis Tools. - Output file name: enter
regularpolygon.tif.
- Output path: set the output to
-
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.