Frequently asked question

Why are there different results when using union of inputs and intersection of inputs with Zonal Statistics?

Last Published: April 25, 2020


Depending on the analysis extents and cell size, the vector data is rasterized many different ways and then the raster is resampled to that same grid structure.

For example: The value raster has a range of a minimum (min) x and y of 0 and a maximum (max) x and y of 100, and a cell size of 10. The vector zone data is a square with the range of min x and y of 25, and a max x and y of 75. Therefore, the envelope of the vector data is not in alignment with the raster cells. In fact, the lower left corner of the vector data is exactly in the center of a cell.

If the analyses extent of union of inputs is used, both layers are analyzed on a Cartesian grid that has an origin of 0,0. The vector data must be rasterized to a grid with this origin. If there is no cell size specified, Spatial Analyst defaults to the maximum cell size of the inputs.

What is this maximum? The raster has a cell size of 10, but what is the cell size of the vector data?

The easiest way to determine this is to use the 'Convert Feature to Raster' tool, accept the default parameters of the tool, and specify the analyses extents to be that of the raster.

Here is another method: take the long axis of the data and divide it into 250 cells. This determines the default cell size for rasterization. With the analysis extent set to the union of inputs, the cell size of the rasterized vector data is 0.4 (100/250). Therefore, the max cell size is 10.

With these environment settings, the vector data is rasterized to the following structure: the zone layer has cells with values to be a square with an extent of min x and y of 20, and a max x and y of 80, and the remaining cells are NoData. The values raster keeps its original structure and there is no resampling of this data. In this case, the same results are returned as the results from the procedure described in the ESRI Knowledge Base document linked below. As an aside, if the zone layer has an extent greater then the value raster, it does not produce the same results because the value grid has to be resampled to a different extent, thereby changing the values of the cells in the value raster.

If the intersection of input is selected as the analysis extent, the extents are that of the input vector data, or min x and y of 25, and a max x and y of 75. The cell size is the same as above, because 10 is larger than 0.2 (50/250). However, unlike the union of inputs described above, the value raster must be resampled. Remember the coordinate 25,25 is in the center of the value raster's cell with the lower left corner of 20,20. This resampling could cause the value raster to have different statistics within the extents of the zone layer.

Use the following procedure to test this. Clip the value raster to an extent of min x and y of 20, and a max x and y of 80. Set the analysis extent to that of the vector zone layer. Then use the expression, output = clipgrid, in the raster calculator. Compare the stats of clip grid with those of the output grid. In this simple case, the above test gives the same change in statistics returned from zonal statistics.

Article ID:000008260

  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic