# Calculating statistics for overlapping and non-overlapping neighborhoods

The neighborhood operations calculate output values by calculating a specified statistic to all the input cells that are contained in each neighborhood. The neighborhood is a moving window that iterates through the input data.

There are two basic kinds of neighborhood operations in Spatial Analyst: the operations where the neighborhoods of the processing locations overlap and those where the neighborhoods do not overlap.

The Focal Statistics tool processes the input dataset with overlapping neighborhoods. The Block Statistics tool processes data with neighborhoods that do not overlap.

In the focal operation, only the processing cells receive the result of the calculation of all the cells in the neighborhood, whereas in the block operation, every cell within the minimum bounding rectangle that contains the neighborhood receives the same output value.

## Neighborhood shape

The defined neighborhood shapes that can be specified are a rectangle of any dimension, a circle of any radius, an annulus (a doughnut shape) of any radius, and a wedge in any direction.

In addition to these geometric shapes, you can also create an irregularly shaped neighborhood, often called a kernel, where you can control exactly which cells in the neighborhood will be included in the calculations. Further, you can also apply different weights to specific cells in the neighborhood.

Cells in the input raster that fall within the specified neighborhood will be included in the calculations being performed for that neighborhood.

For more specific information about how particular cells are included in a neighbourhood, refer to the individual tool reference topics, or see the following topics:

## Types of neighborhood statistics

Various statistics can be computed on the cell values within the neighborhood being processed:

• For Focal Statistics, the result of the calculation is applied only to locations corresponding to the processing cell on the output raster.
• For Block Statistics, the result of the calculation is applied to all cells that are within the processing neighborhood.
StatisticDescription

Majority

Determines the value that occurs most often in the neighborhood

Maximum

Determines the maximum value in the neighborhood

Mean

Computes the mean of the values in the neighborhood

Median

Computes the median of the values in the neighborhood

Minimum

Determines the minimum value in the neighborhood

Minority

Determines the value that occurs least often in the neighborhood

Percentile

Determines the specified percentile value of the cells in the neighborhood. This option is available for the Focal Statistics tool only.

Range

Determines the range of values in the neighborhood

Standard deviation

Computes the standard deviation of the values in the neighborhood

Sum

Computes the sum of the values in the neighborhood

Variety

Determines the number of unique values in the neighborhood

Neighborhood statistics