Summary
The Zonal Statistics tool from the Image Analyst Extension can present some challenges. This article breaks down the process, and provides suggestions that can help avoid common pitfalls when running the tool. There are four important points to note:
- Both the raster layer and the input vector layer must be in the same coordinate system.
- The field selected as "Value" in the tool must be an integer field. If you have a numeric field that contains values, but the values are decimals, for example 0.346, create a new field in the attribute table, define it as Long Integer, then multiply those decimal values by 100, or 1000 - a large enough number to convert the decimals to integers for processing. In the last step in the instructions below, divide the output value by 1000, or whatever mulitplier used, to convert the results back to decimals if necessary.
- The data used in this tool should be in a Projected Coordinate System, with linear units of feet or meters.
- Using the Geodesic (Shape preserving) option is recommended.
Procedure
- In this example, the layer being used to overlay the raster to be evaluated is a line layer. To limit the output area from the analysis, ther are two options when working with vector line data. Skip this step if the overlay vector layer are polgyons:
- Run the Feature Envelope to Polygon tool, which creates a bounding box around each line, or

-
- Run the Buffer tool to create a polygon of a suitable size surrounding each line.

- Take the polygon input from Step 1, then run the Polygon to Raster tool, as shown in the next image, to convert those individual polygons to pixels, since Zonal Statistics performs much better with two raster layers.

As noted above, the Value field must be an integer. The Cellsize is calculated authomatically.
- Preparing to run the Zonal Statistics tool after the above prep work is done, click on the Environments for the tool, scroll down to Mask, and select the raster layer from Step 2 as the Mask layer.

- Run the Zonal Statistics tool, specifying the Value field as the Integer field that contains the values of interest. This creates the desired output for the polygon or buffer that surrounds each line.
- Input Raster or Feature Zone Data - the original raster containing the data to be analyzed.
- Zone field - The field containing values for analysis. This is an Integer field.
- Input Value Raster - Raster created in Step 2 above, also used as the Mask.
- Output Raster - May be .tif, jpg, or other raster type, or written to a file geodatabase.
- Statistics Type - Mean is the default.

- If the original Value field as noted in the description was a decimal, the last step is to create a final Value field as Double. Populate the field with the output Value divided by 100 or 1000, or other mutliplier necessary to return those values to decimals.