You are on page 1of 7

# Zonal Statistics in ArcGIS

The Zonal Statistics function calculates statistics on values of a raster within the zones of another dataset. A statistic is calculated for each zone of a zone dataset based on values from another dataset. Zonal statistical functions perform operations on a per zone basis; a single output value is computed for every zone in the input dataset. A zone is all the cells in a raster that have the same value, regardless of whether or not they are contiguous. However, either raster or feature datasets can be used as the zone dataset. Why is this useful? An example Zone dataset soil polygons Input raster percent slope

What is the minimum, maximum, and mean slope for each mapunit?

Using Zonal Statistics In this exercise, we use an elevation grid and soil polygon feature class to produce a report summarizing the slope values for each map unit.

Step 1: Set up ArcMap Open ArcMap and add the following data layers: Digital elevation model (DEM) soil polygon feature class

Activate the Spatial Analyst Extension. From the ArcMap main menu, select Tools, then Extensions. The Spatial Analyst extension should be checked.

Add the Spatial Analyst toolbar by Right-clicking in the toolbar area of ArcMap and select Spatial Analyst. Zoom to the Full extent. From the ArcMap main menu, select Tools, the Options. On the Geoprocessing tab, select Environments Set the following Environment Settings: General Settings Current Workspace Scratch Workspace Output Coordinate System: Same as DEM layer Extent: Same as Display Snap Raster: select DEM layer Raster Analysis Settings Cell Size: Same as DEM layer

Step 2: Data preparation Create a percent slope grid from the DEM Examine the DEM layer properties to verify that the unit of measure for z units (elevation values) is the same as the x, y units (e.g. all values are in meters). If not, convert the DEM to same units or use a z-factor in the slope calculation.

1. Click the Spatial Analyst dropdown arrow and select Surface Analysis, then Slope.

2. Select DEM as the Input surface. 3. Select Percent for Output measurement. 4. Set Z factor if needed, the default value of 1 is used if DEM has same units of measure for x, y and z units. 5. Output cell size should be same as cell size of the DEM. 6. Name Output raster and click OK.

Step 3: Calculate Zonal Statistics In the ArcToolbox window, expand the Spatial Analyst Tools, then the Zonal toolset. Double click the Zonal Statistics as Table tool.

Click on the drop-down arrow next to the Input raster or feature zone data field and select the created soil polygon raster. Select

MUSYM for the Zone field and the percent slope raster for the Input value raster. Verify that the Ignore NoData in calculations box is checked. Name the Output table and click OK. After the Zonal Statistics as Table Tools is finished running, add the created table to the map document. (The table will be visible on the Source tab of the Table of Content window, but not on the Display

On the ArcMap main menu, select Tools, Reports, and Create Report. On the Report Properties window, click on the Layer/Table drop-down list and select the output zonal statistics table. In the Available Fields window, select MUSYM, then click on the right arrow button to add the MUSYM field to the Report Fields window. Add MIN, MAX, RANGE, and MEAN to the Report Fields window. Select Generate Report.

The format of this table must be edited for presentation. After the format is edited the report can be saved for future use. Close the Report View window by clicking on the X at the upper right corner.

In the Report Properties dialog box, select the Display tab. Expand Elements under Settings. Click in the box beside Title to enter a title for the report. Click in the Value space in the Text Property and enter your title. Expand the Field Settings and select MUSYM to open its properties. Enter 0.8 for the Width value.

Finish entering these values for Width: MUSYM 0.8 MIN 0.8 MAX 0.8 MEAN 1.2 Select Generate Report. If the report is acceptable, then you can print and/or save the report.

## Using the ArcGIS Spatial Analyst toolbar to calculate Zonal Statistics

Before starting Verify that the Spatial Analyst extension is active. From the ArcMap main menu, select Tools, then Extensions. The Spatial Analyst extension should be checked. To add the Spatial Analyst toolbar, right-click in the toolbar area of ArcMap and select Spatial Analyst.

1. Click the Spatial Analyst dropdown arrow and click Zonal Statistics. 2. Click the Zone dataset dropdown arrow and click the layer you want to use. 3. Click the Zone field dropdown arrow and click the field of the Zone layer you want to use. 4. Click the Value raster dropdown arrow and click the raster you want to use. 5. Uncheck the Ignore NoData in calculations check box to use the NoData values of the value raster in the calculation. 6. Check the check box to join the output table to the zone layer. 7. This option is only available for layers, not datasets you browse to. 8. Click the Chart statistic dropdown arrow and click the type of statistic you want to chart. 9. Specify a name for the output table, or leave the default to create a table in your working directory. 10. Click OK.

More Information about Zonal Statistics The following statistics can be computed within each zone: Statistic Majority Maximum Mean Median Minimum Minority Range Standard Deviation Sum Variety Description Determines the value that occurs most often in the zone. Determines the maximum value in the zone. Computes the mean of the values in the zone. Computes the median of the values in the zone. Determines the minimum value in the zone. Determines the value that occurs least often in the zone. Determines the range of values in the zone. Computes the standard deviation of the values in the zone. Computes the sum of the values in the zone. Determines the number of different values in the zone.

If the zone input is a raster, it must be integer. If the zone input is a feature class, the zone field must be integer or character. It is recommended to only use rasters as the zone input. This offers greater control over the vector-to-raster conversion and ensures consistent results. If the zone input is a raster dataset, it must have an attribute table. You can use the Build Raster Attribute Table tool to create one if necessary. The input 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.