# The types of operations in Spatial Analyst

The operations of cell-based analysis available in Spatial Analyst can be divided into five types:

- Those that work on single cell locations (local operations)
- Those that work on cell locations within a neighborhood (focal operations)
- Those that work on cell locations within zones (zonal operations)
- Those that work on all cells within the raster (global operations)
- Those that perform a specific application (for example, hydrologic analysis operations)

Each of these categories can be influenced by, or based on, the spatial or geometric representation of the data and not solely on the attributes that the cells portray. For example, a tool that adds two layers together (via single cell locations) is dependent on the cell's location and the value of its counterpart in the second layer. Tools applied to cell locations within neighborhoods or zones rely on the spatial configuration of the neighborhood or zone as well as the cell values in the configuration.

## Local operations

Local operations, or per-cell functions, compute a raster output dataset where the output value at each location (cell) is a function of the value associated with that location on one or more raster datasets. That is, the value of the single cell, regardless of the values of neighboring cells, has a direct influence on the value of the output. A per-cell operation can be applied to a single raster dataset or to multiple raster datasets. For a single dataset, examples of per-cell operations include the trigonometric tools, for example, Tan, or the logarithmic tools—for example, Log2.

Local operations can also be performed on multiple input rasters. In this case, a single value will be returned for each cell based on some operation being applied to the corresponding cell in each of the input rasters. An example of this type of operation is using the Cell Statistics tool: for each output cell, a statistical calculation (such as the mean or range) is performed on the cell values of all the input rasters at that corresponding location.

## Focal operations

Focal, or neighborhood, operations produce an output raster dataset in which the output value at each cell location is a function of the input value at a cell location and the values of the cells in a specified neighborhood around that location. As each cell in the input is processed, the neighborhood is essentially a moving window that shifts along with it. The configuration (size and shape) of the neighborhood determines specifically which cells surrounding the processing cell should be used in the calculation of each output value. The most typical neighborhood is 3 by 3 cells, which incorporates the processing cell and its closest eight neighbors.

## Zonal operations

Zonal operations compute an output raster dataset where the output value for each location depends on the value of the cell at the location and the association that location has within a cartographic zone. Zonal operations are similar to focal operations except that the definition of the neighborhood in a zonal operation is the configuration of the zones themselves, not a specified neighborhood shape. Individual zones can be of any shape or size and can be disconnected from each other. Zones can be defined either as raster or feature data. For raster data, a zone is all cells with the same value. For feature data, a zone is all features with the same attribute value (LandClass = 4, for example).

An example zonal operation is to return the mean (average) of values from the first dataset that fall within a specified zone of the second.

## Global operations

Global, or per-raster, operations compute an output raster dataset in which the output value at each cell location is potentially a function of all the cells combined from the various input raster datasets. There are two main groups of global operations: Euclidean distance and weighted distance.

### Euclidean distance global operations

Euclidean distance global operations assign to each cell in the output raster dataset its distance from the closest source cell. An example of a source may be the location from which to start a new road. The direction of the closest source cell can also be assigned as the value of each cell location in an additional output raster dataset.

### Non-Euclidean (weighted) distance global operations

Non-Euclidean distance operations determine the cost of moving from a destination cell to the nearest source cell over a surface that is weighted by some cost in addition to Euclidean distance. An example is planning to build a road from point A to point B, where the shortest, most direct path would in fact be more expensive to build on if the surface is steep or the ground composition is too soft (a swamp, for example).

In all the global calculations, knowledge of the entire surface is necessary to return the solution.

## Application operations

There are some cell-based modeling operations developed to solve specific applications. An application operation performs an analysis that is specific to a discipline. For example, the hydrologic operations create a stream network and delineate a watershed. The local, focal, zonal, and global operations are general operations and are not specific to any application. There is some overlap in the categorization of an application operation and the local, focal, zonal, and global operations (for example, even though slope is usually used in the application of analyzing surfaces, it is also technically a focal operation). Some of the application operations are more general in scope, such as surface analysis, while other application functions are more narrowly defined, such as hydrologic analysis functions. The categorization of the application operations into groups helps in understanding both the scope and specific capabilities of these operations.

Application operations include the following:

- Altering raster resolution
- Density analysis
- Hydrologic analysis
- Image classification
- Generalization
- Surface analysis
- Surface generation