How Zonal Statistics works

With the Zonal Statistics tool, a statistic is calculated for each zone defined by a zone dataset, based on values from another dataset (a value raster). A single output value is computed for every zone in the input zone dataset.

The Zonal Statistics as Table tool calculates all, a subset or a single statistic that is valid for the specific input but returns the result as a table instead of an output raster.

A zone is all the cells in a raster that have the same value, whether or not they are contiguous. The input zone layer defines the shape, values, and locations of the zones. An integer field in the zone input is specified to define the zones. A string field can also be used. Both raster and feature datasets can be used as the zone dataset.

The input value raster contains the input values used in calculating the output statistic for each zone.

In the following illustration, the Zone layer demonstrates an input raster that defines the zones. The Value layer contains the input for which a statistic is to be calculated per zone. In this example, the maximum of the value input is to be identified for each zone.

Example inputs and output from Zonal Statistics
Example inputs and output from Zonal Statistics

Output data type

The output data type is determined by both the selected statistic type and the value input type. The following table identifies the expected data types of the output raster:

Statistic

Zone input type

Value input type

Output

Majority

Integer or String

Integer *

Integer

Maximum

Integer or String

Integer, Float

Same as Value

Mean

Integer or String

Integer, Float

Float

Median

Integer or String

Integer *

Integer

Minimum

Integer or String

Integer, Float

Same as Value

Minority

Integer or String

Integer *

Integer

Range

Integer or String

Integer, Float

Same as Value

STD

Integer or String

Integer, Float

Float

Sum

Integer or String

Integer, Float

Float

Variety

Integer or String

Integer *

Integer

Input and output types by statistic
* Only integer is supported.

If any cell location on the Zone dataset is NoData, that location will be assigned NoData on the output.

Majority

Example:

Zonal Statistics Majority illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Majority")

Maximum

Example:

Zonal Statistics Maximum illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Maximum")

Mean

Example:

Zonal Statistics Mean illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Mean")

Median

Example:

Zonal Statistics Median illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Median")

Minimum

Example:

Zonal Statistics Minimum illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Minimum")

Minority

Example:

Zonal Statistics Minority illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Minority")

Range

Example:

Zonal Statistics Range illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Range")

STD

Example:

Zonal Statistics Std illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "STD")

Sum

Example:

Zonal Statistics Sum illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Sum")

Variety

Example:

Zonal Statistics Variety illustration
OutRas = ZonalStatistics(ZoneRas, "VALUE", ValRas, "Variety")

Related Topics

4/10/2014