Available with Image Server

The Zonal Statistics tool summarizes the values of a raster within the zones of another dataset.

The output is a hosted imagery layer.

Learn how the zonal statistics tools work

##### Note:

Zonal Statistics was named Summarize Raster Within in Map Viewer Classic.

## Examples

Example scenarios for using this tool include the following:

- Given a layer of watershed boundaries and a layer of land-use boundaries by land-use type, calculate the total acreage of land-use type for each watershed.
- Given a layer of parcels in a county and a layer of city boundaries, summarize the average value of vacant parcels within each city boundary.

## Usage notes

Zonal Statistics includes configurations for input layers, statistical analysis settings, and the result layer.

### Input layers

The Input layers group includes the following parameters:

Input zone raster or features specifies the input that defines the boundaries of the zones, or areas, that will be summarized. A zone is defined as all areas in the input that have the same value. The areas do not have to be contiguous. Both raster and feature data can be used for the zone input.

You can choose a layer using the Layer button or use the Draw input features button to create a sketch layer to use as the input.

If the zone input is a raster, it must be an integer raster. The zones are defined by all locations in the input that have the same cell value.

If the zone input is a feature, it will be converted to a raster internally using the cell size and cell alignment from Input value raster.

If the zone input is a point feature, it may have more than one point contained within any particular cell of the value input raster. For such cells, the zone value is determined by the point with the lowest ObjectID field (for example, OID or FID).

Zone field specifies the field that contains the values that define each zone.

It can be an integer or a string field of the zone layer.

When specifying the zone input, the default zone field will be the first available integer or text field. If no other valid fields exist, the ObjectID field (for example, OID or FID) will be the default.

Input value raster specifies the raster that contains the values on which a statistic will be calculated.

It can be either integer or floating point. However, when it is floating-point type, the options for calculating the majority, minority, and variety statistics will not be available.

Interactions between the Input layers group parameters are listed below.

When the zone and value inputs are both rasters of the same cell size and the cells are aligned, they will be used directly in the tool and will not be resampled internally.

When the cell size of the zone raster and the value raster is different, the output cell size will be the maximum of the input, and the value raster will be used as the snap raster internally.

If the cell size is the same but the cells are not aligned, the value raster will be used as the snap raster internally.

Both of these cases will trigger an internal resampling before the zonal operation is performed.

If a particular zone does not overlap any cell centers of the value raster, those zones will not be converted to the internal zone raster. As a result, those zones will not be represented and will become NoData in the output.

You can manage this by first determining an appropriate raster resolution that will retain the detail of the zone input; then use this resolution as the cell size in the environment.

Specifying a smaller cell size in the Cell size environment setting will generate a larger output raster. The higher resolution output will not necessarily be as high quality a result, since the additional detail does not exist.

The Processing extent environment setting will affect how the input layers are analyzed. In the Environment settings, if Processing extent is set to Use current map extent, only the elements in the Input zone raster or features layer and the Input value raster layer that are visible within the current map extent will be analyzed.

If the Processing extent environment is set to the Default option, all of the elements in both the zone layer and the value layer will be analyzed, even if they are outside the current map extent.

### Statistical analysis settings

The Statistical analysis settings group includes the following parameters:

Statistic type specifies the statistic type to be calculated. The statistic will be calculated for all cells in the value raster that belong to the same zone as the output cell.

The statistics type can be Majority, Maximum, Mean, Median, Minimum, Minority, Percentile, Range, Standard deviation, Sum, or Variety. The default is Mean.

The available statistic type depends on the data type of the Input value raster value, and the statistic calculation type specified by the Calculate circular statistics parameter.

If the data type is integer, arithmetic statistics calculation supports the Mean, Majority, Maximum, Median, Minimum, Minority, Percentile, Range, Standard deviation, Sum, and Variety options. Circular statistics calculation supports the Mean, Majority, Minority, Standard deviation, and Variety options.

If the data type is float, arithmetic statistics calculation supports the Mean, Maximum, Median, Minimum, Percentile, Range, Standard deviation, and Sum options. Circular statistics calculation supports the Mean and Standard deviation options.

If the Input value raster parameter value is floating-point type, the calculations for Majority, Minority, and Variety cannot be computed.

For majority and minority calculations, when there is a tie, the output will be the lowest of the tied values.

Percentile value specifies the percentile to calculate. The default is 90, indicating the 90th percentile.

The value can range from 0 to 100. The result of specifying the 0th percentile is essentially equivalent to that of the minimum statistic, and the 100th percentile is equivalent to the maximum statistic. A value of 50 will produce essentially the same result as the median statistic.

This parameter is only available if the Statistic type parameter is set to Percentile.

Percentile interpolation type specifies the method of interpolation that will be used when the percentile value falls between two cell values from the input value raster. This can occur when the number of values from the input raster to be calculated is even.

The setting for this input can be Auto-detect, Nearest, or Linear. The default is Auto-detect.

For Auto-detect, if the input value raster is of integer pixel type, the Nearest method will be used. If the input value raster is of floating-point pixel type, the Linear method will be used.

For Nearest, the nearest available value to the specified percentile is used. In this case, the output pixel type is the same as that of the input value raster.

For Linear, the weighted average of the two surrounding values from the specified percentile is used. In this case, the output pixel type is floating point.

This parameter is only available if the Statistic type parameter is set to Percentile.

Calculate circular statistics specifies how the statistics type will be calculated for circular data.

If unchecked, ordinary arithmetic (linear) statistics will be calculated. This is the default.

If checked, circular statistics will be calculated. Specify an appropriate value for the Circular wrap value parameter.

For circular statistics, the available statistics options depend on the data type of the Input value raster parameter value. If it is integer, the Mean, Majority, Minority, Standard deviation, and Variety options are available. If it is floating point, the Mean and Standard deviation options are available.

Circular statistics are appropriate for cyclic quantities such as compass direction in degrees, daytimes, and fractional parts of real numbers.

Circular wrap value specifies the value that will be used to round a linear value to the range of a given circular statistic. It is a positive number. The wrap value is the highest possible value (upper bound) in the cyclic data. This value also represents the same quantity as the lowest possible value (lower bound). The default value is 360.

This parameter is only available when circular statistics are calculated.

Ignore NoData specifies whether NoData cells in the input value raster will be ignored in the results of the zones they fall within.

If checked, within any particular zone, only cells that have a value in the value input will be used in determining the output value for that zone. NoData cells in the value raster will be ignored in the statistic calculation. This is the default.

If unchecked, within any particular zone, if NoData cells exist in the value raster, they will not be ignored, and their existence indicates that there is insufficient information to perform statistical calculations for all the cells in the zone. Consequently, the entire zone will receive the NoData value on the output raster.

Process as multidimensional specifies how the input rasters will be processed if they are multidimensional.

If checked, statistics will be calculated from the current slice of the input multidimensional dataset.

If unchecked, the statistics will be calculated for all dimensions of the input multidimensional dataset. This is the default.

### Result layer

The Result layer group includes the following parameters:

Output raster name is the name of the output raster layer that will be created and added to the map.

The name must be unique. If a layer with the same name already exists in your organization, the tool will fail and you will be prompted to use a different name.

- Save in folder specifies the name of a folder in My content where the result will be saved.

## Limitations

The following limitations apply to the tool:

If the Input zone raster or features parameter data has overlapping polygons, the zonal analysis will not be performed for each individual polygon. Since the feature input is converted to a raster, each location can have only one value.

## Environments

Analysis environment settings are additional parameters that affect a tool's results. You can access the tool's analysis environment settings from the Environment settings parameter group.

This tool honors the following analysis environments:

- Output coordinate system
- Processing extent
##### Note:

The default processing extent in Map Viewer is Full extent. This default is different from Map Viewer Classic in which Use current map extent is enabled by default.

- Snap raster
- Cell size
- Mask
- Parallel processing factor

## Outputs

This tool includes the following outputs:

One raster layer showing the result of the zonal operation

The Zonal Statistics tool calculates one statistic at a time. For each cell in the output, the value represents the calculated value for all the input cells that correspond to that zone.

## Usage requirements

This tool requires the following licensing and configurations:

- Creator or GIS Professional user type
- Publisher or Administrator role, or an equivalent custom role
- ArcGIS Image Server configured for raster analysis

## Resources

Use the following resources to learn more:

- How the zonal statistics tools work in ArcGIS Pro
- Summarize Raster Within in ArcGIS REST API
- summarize_raster_within in ArcGIS API for Python
- zonal_statistics in ArcGIS API for Python
- Zonal Statistics as Table in ArcGIS Enterprise
- Summarize Raster Within in ArcGIS Pro with the Raster Analysis extension
- Zonal Statistics in ArcGIS Pro with the Spatial Analyst extension