Zonal Statistics

Open Table of Contents ToolBox Implementation
Analyses the values of a raster within each polygon of the input polygon dataset. Calculates statistics for each polygon and adds them in the attribute table of the output.

Inputs:

  • A polygon feature class
  • A raster dataset for which the statistics will be calculated.
  • A prefix for the field names. The function adds several fields to the polygon attribute table. The prefix will help the user to calculate the statistics of several rasters for the same polygons and add the results to the same attribute table. For example the user wants to calculate statistics for the slope and elevation for a polygon dataset. This requires two different rasters (Elevation and Slope). The function needs to be run twice
    • on the Elevation raster with prefix "EL"
    • on the Slope raster with prefix "SL"

The result will contain fields "EL_Min", "EL_Max", "SL_Min", "SL_Max", etc.

Outputs:

  • A polygon dataset - a copy of the original polygons
  • All the original attributes will be preserved.
  • Depending on the type of the raster used, the following statistics will be calculated for each polygon and added to the attribute table of the output (XXX in the field names below replaces the prefix used in the function).
    • Integer and Floating point rasters
      • XXX_Count - the number of cells within a zone
      • XXX_Sum - the sum of the cell values within a zone
      • XXX_Min - the minimum values within a zone
      • XXX_Max - the maximum value within a zone
      • XXX_Range - the range of values within a zone
      • XXX_Mean - the average of the values within a zone
      • XXX_STD - the standard deviation of the values in a zone
      • XXX_Median - the median value in a zone
    • Integer rasters only
      • XXX_Major - the majority value (the value that appears most timesin a zone).
      • XXX_Minor - the minority value (the value that appears least times in a zone).
      • XXX_Var - variety (the number of unique values in a zone).

Notes:

  • If the input polygon dataset has multi-part polygons, they will be exploded into single part polygons and the statistics will be calculated for the single part polygons.

ToolBox implementation

Command line syntax

ETS_GPZonalStatistics <Input Polygons> <Input Raster>  <Out Raster> <Prefix>

Parameters

Expression Explanation
<Input Polygons> A Polygon layer or feature class
<Input Raster> A  Raster dataset or Raster layer
<Out File Name> A String - the full name of the output feature class.
<Prefix> A String (maximum 3 characters) representing the prefix. See description above.

Scripting syntax

ETS_GPZonalStatistics (Input Polygons, Input RasterOut File Name, Prefix)

See the explanations above:
<> - required parameter
{} - optional parameter

All ESRI products mentioned are trademarks of Environmental Systems Research Institute, Inc.
Copyright: Ianko Tchoukanski