Calculate Zonal Statistics
Overview
Calculate raster cell statistics by vector zone and write the results to the output vector attribute table.
Zonal statistics uses vector zones as spatial grouping units. It calculates statistics such as sum, mean, and count for the cells covered by each zone, then writes the results back to the attribute table of the output features.
Use Cases
- Summarize elevation, rainfall, temperature, or vegetation-index rasters by administrative boundary, watershed, or planning zone.
- Produce per-zone indicators for reports, thematic maps, or model inputs.
- Improve efficiency for batch processing, repeated runs, or standardized delivery.
Parameters
| Parameter | Description | Notes |
|---|---|---|
| Input raster file | Raster data for zonal statistics | Required |
| Input vector zone file | Vector boundary file used as zones | Required |
| Statistics methods | Statistical methods for raster cells within each zone | Required; default: ['sum']; options include sum (sum), mean (mean), maximum (max), minimum (min), standard deviation (std), variance (var), median (median), count (count), and others |
| Include all touched cells | If True, includes all cells touched by a zone boundary. If False, includes only cells whose center points are inside the zone | Optional; default: False |
| Output vector file | Output vector file containing zonal statistics results | Required |
Steps
- Start the tool: Open Geoprocessing Toolbox → Spatial Analysis Tools > Regional Analysis, then start the Calculate Zonal Statistics tool pane.
- Prepare input: Select the Input raster file and Input vector zone file, then confirm that both datasets are complete and readable.
- Set core parameters: Configure Statistics methods and Include all touched cells based on the reporting requirement.
- Set output: Specify the Output vector file and confirm that the output path, format, and naming rules meet downstream requirements.
- Run and inspect the result: Click Run, then check the output attribute table and verify that statistics were written for each zone as expected.
Notes
- The raster and zone layer should use compatible coordinate systems and spatial extents.
- The Include all touched cells option can change results along zone boundaries, especially for small zones or coarse rasters.
- NoData cells are usually excluded from statistics; confirm this behavior before using the results for reporting.