Skip To Content

Zonal Statistics function

Available with Image Analyst license.

Available with Spatial Analyst license.

Overview

Calculates statistics on values of a raster within the zones of another dataset.

A zone is defined as all areas in the input that have the same value. These areas do not have to be contiguous. When the zone and value inputs are both rasters of the same resolution, they will be used directly. If the resolutions are different, an internal resampling is applied to make the resolutions match before the zonal operation is performed.

Zonal Statistics illustration
The minimum statistics type.)

Learn more about how Zonal Statistics works

Notes

Zone Raster must be a raster input. If you have a feature as your zones, you must convert it into a raster before it can be used in this function. If the zone input is a feature dataset with relatively small features, keep in mind that the resolution of the information needs to be appropriate relative to the resolution of the value raster. If the areas of single features are similar to or smaller than the area of single pixels in the value raster, in the feature-to-raster conversion some of these zones may not be represented.

Your Zone Raster must have an attribute table. The attribute table is usually created automatically for integer rasters, but may not under certain circumstances. You can use the Build Raster Attribute Table tool to create one.

When specifying the input zone data, the default Zone Field will be the first available valid field. If no other valid fields exist, the ObjectID field (for example, OID) will be the default. If a reserved field such as OID is selected for the Zone Field, then this may cause some ambiguity in the result. The result includes the particular reserved field name necessary for the particular output format type, as well as the Zone Field specified. If the specified field has the same name as the reserved field for the particular output format, in the output, the name for the zone field will be altered in such a way that all field names in the result are unique. To make a field of unique values that does not have a reserved name, use the Add Field and Calculate Field geoprocessing tools

Value Raster can be either integer or floating point. However, when it is floating-point type, the zonal calculations for Majority, Median, Minority, and Variety will not be computed.

The data type of the output is dependent on the zonal calculation being performed and the input Value Raster type, see How zonal statistics works for more information.

For Majority and Minority calculations, when there is a tie, the output for the zone is based on the lowest of the tied values.

Should there be any NoData pixels in the inputs, the resampling may cause there to be larger areas of NoData in your output than you might have expected. To avoid this situation, either resample the coarser input rasters to the resolution of the finer input raster, or set the cell size to Minimum Of Inputs in the geoprocessing Environments.

By default, this tool will take advantage of multi-core processors. The maximum number of cores that can be utilized is limited to 4. If you wish the tool to use fewer cores, use the Parallel Processing Factor geoprocessing environment.

See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this function.

Parameters

Parameter nameDescription

Zone Raster

(Required)

Dataset that defines the zones. The zones can be defined by an integer raster.

Zone Field

(Required)

Field that holds the values that define each zone. It can be an integer or a string field of the zone raster.

Value Raster

(Required)

Raster that contains the values on which to calculate a statistic.

Statistics Type

Statistic type to be calculated.

  • Mean—Calculates the average of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Majority—Determines the value that occurs most often of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Maximum—Determines the largest value of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Median—Determines the median value of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Minimum—Determines the smallest value of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Minority—Determines the value that occurs least often of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Range—Calculates the difference between the largest and smallest value of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Standard Deviation—Calculates the standard deviation of all pixels in the Value Rasterthat belong to the same zone as the output pixel.
  • Sum—Calculates the total value of all pixels in the Value Raster that belong to the same zone as the output pixel.
  • Variety—Calculates the number of unique values for all pixels in the Value Raster that belong to the same zone as the output pixel.

Ignore NoData in calculations

Denotes whether NoData values in the Value Raster will influence the results of the zone that they fall within.

  • Yes - Within any particular zone, only pixels that have a value in the Value Raster will be used in determining the output value for that zone. NoData pixels in the Value Raster will be ignored in the statistic calculation. This is the default.
  • No - Within any particular zone, if any NoData pixels exist in the Value Raster, it is deemed that there is insufficient information to perform statistical calculations for all the pixels in that zone; therefore, the entire zone will receive the NoData value on the output raster.

Environment settings

Geoprocessing Environment settings for global functions are controlled at the application level. Setting processing environments in ArcGIS Pro can be done by selecting the Environments button on the Analysis tab. See Analysis environments and Spatial Analyst for additional details on environment settings.

The following environments are supported by this global function: