Calculating Zonal Statistics
Included in this tutorial:
The Zonal Statistics as Table tool: Accessing the tool, Tool parameters and options
Examples:
Example 1: Zonal Statistics with Polygon Zone Data
Example 2: Zonal Statistics with Raster Zone Data
Two Tools: Zonal Statistics versus Zonal Statistics as Table
Software version in examples: ArcGIS Pro 3.0.2
Tutorial Data: The tutorial includes demonstration with sample data available here.
Credits: L. Meisterlin (2022)
This tutorial demonstrates using the Zonal Statistics as Table tool in ArcGIS Pro to calculate summary statistics from the values within a raster dataset based on its cells’ overlap with those of another (zone) raster. It also describes the differences between the Zonal Statistics as Table and the Zonal Statistics tools.
Related: This tool requires either the Spatial Analyst Extension in ArcGIS Pro. To verify your extensions, see Which Esri Extensions Is My Software Licensed to Use?
the Zonal Statistics as Table tool
Accessing the tool
Access the Zonal Statistics as Table tool by clicking through Spatial Analyst Tools > Zonal > Zonal Statistics as Table in the Geoprocessing panel. You can also search for “Zonal Statistics as Table” in the geoprocessing search bar.
Tool Parameters and Options
The Zonal Statistics as Table tool’s options include an input value raster, input zone data (and field, if appropriate), the output table, and statistics options.
the Zonal Statistics as Table tool options
Statistics Type drop-down menu
Here’s a brief description of the input options:
Input Raster or Feature Zone Data: Specify the layer (whether a zone raster or vector polygons) that defines the zones within which summaries will be calculated.
Zone Field: Specify the field from the input zone data that uniquely identifies each zone.
Input Value Raster: Specify the raster layer with cells values to be summarized per zone.
Output Table: Specify the name and location of the output table.
If the output table is not a geodatabase table, you must specify the output type with a file extension (e.g., .csv, .txt).
Ignore NoData in Calculations checkbox: Specify whether to include or ignore cells with “NoData” values in the calculations (effectively giving them a value of zero).
Statistics Type: Specify which summary statistics should be calculated for the input value raster’s cells overlapping each zone. (See the screenshot above, right.) For a brief explanation of the options, click the blue information icon next to the input name.
Percentile Values (optional): If the Statistics Type is set to All or Percentiles, specify here which percentiles to calculate. (For example, “50” returns the median value.) You can add percentile values by clicking “Add Another.”
Calculate Circular Statistics (optional): When left unchecked, the tool processes linear statistics.
Process as Multidimensional (optional): Check this only if you are using multidimensional input rasters.
To execute the tool, click Run.
Examples
The examples in this tutorial use the Standard Data Package from Tutorial Data.
The input rasters were produced by rasterizing two feature classes in the data package: the Tract_wTable layer based on the int_sm value and the BX_FourCDs based on the BoroCD value to serve as the zone layer. For more on rasterizing see Converting Vector Features to Rasters.
Example 1: Zonal Statistics with Polygon Zone Data
This example calculates the minimum, maximum, and mean value of the cells (from the Tracts_Int_sum layer) based on their spatial overlap with the four polygons of the BX_FourCDs layer.
Given the number of “NoData” cells in our rasters (which are indeed rectangular), the “Ignore NoData in Calculations” option is checked in our example.
Example 1 Input Layers, with the unique fields of the BX_FourCDs labeling each of its four polygon features
Example 1 inputs within the Zonal Statistics as Table options
The example results are output as a standalone table, shown in the screenshot below.
The table includes the following fields:
Zone Field: In our example, this is the BoroCD field of the zone polygon features.
Count: The total count of cells (from the input value raster) within each zone.
Area: This total area of the cells (from the input value raster) within each zone, calculated in the units of the input value raster CRS.
Summary Statistics calculated based on the input settings.
In our example, we calculated Min (minimum value), MAX, (maximum value), and MEAN value of the cells from the input value raster within each zone.
results of Example 1
Example 2: Zonal Statistics with Raster Zone Data
This example calculates the minimum, maximum, and mean value of the cells the same input value raster used in Example 1 based on their spatial overlap with the rasterized version of the same four polygons of the BX_FourCDs layer. The screenshots below illustrate the inputs.
Given the number of “NoData” cells in our rasters (which are indeed rectangular), the “Ignore NoData in Calculations” option is again checked in our example.
Input Zone Raster for Example 2. (Input Value Raster is the same as shown in Example 1.)
Example 2 Inputs within the Zonal Statistics as Table options
The example results are output as a standalone table, shown in the screenshot below.
The table includes the fields listed below. Notice that, aside from the field header indicating the zone (based on the tool’s Zone Field parameter), the other fields and their values are identical to the results in Example 1. This is because both examples use the same input value raster and calculate the statistics based on the same zones. The only difference is Example 1’s zone data includes polygon features, and Example 2’s zone data is a rasterized version of those polygons.
Zone Field: In our example, this is the Value of the zone zone raster cells. (These match the four values in our input zone raster, illustrated above.)
Count: The total count of cells (from the input value raster) within each zone.
Area: This total area of the cells (from the input value raster) within each zone, calculated in the units of the input value raster CRS.
Summary Statistics calculated based on the input settings.
In our example, we calculated Min (minimum value), MAX, (maximum value), and MEAN value of the cells from the input value raster within each zone.
results of Example 2
Two tools: Zonal Statistics vs. Zonal Statistics as Table
Both the Zonal Statistics tool and the Zonal Statistics as a Table tool calculate the summary statistics of the values within an input values raster based on the zones established by another layer (vector or raster).
The Zonal Statistics tool calculates one statistic at a time outputting the results in a new raster layer.
The Zonal Statistics as a Table tool, demonstrated above, can calculate multiple statistics with one process, outputting the results in a table.