﻿ Building Blocks of Spatial Analysis > Grid Operations and Map Algebra > Operations on single and multiple grids

# Operations on single and multiple grids

Grid or raster data files typically have a single attribute associated with each cell position. Datasets of this type can be thought of as triples (x,y,z) where x and y are the cell coordinates and z the attribute values. z-values might be: a color code in the case of image data; a binary value, for example in the case of converted vector data (without additional attributes); a cell classification number, such as the type of vegetation cover associated with that location; or a measured or calculated data value, such as an interpolated figure for soil heavy metal content in parts per million (ppm), the height of a surface in meters, or the estimated average level of noise from a given source type (e.g. roads). In all instances the set of values observed in a single grid of size M-rows and N-columns is limited, either by the coding or classification procedure adopted, or by the fact that ultimately only MxN values can possibly be recorded.

This set of values may be summarized and analyzed using basic univariate statistics (non-spatial analysis) and many GIS packages provide a wide number of simple single-grid measures. These include many of the basic statistics described in Table 1‑3, including the arithmetic mean, max, min, count, sum, variety, minority, majority, range, mid-range, variance and standard deviation. Each of these operations applies to the set of individual cells of a single grid and may be described as local statistics.

Simple statistical operations may be applied to groups of cells, for example the immediate 8 cell neighborhood (or window) of each cell or to individual cells across multiple grids (see also, Section 5.3, Grid-based Statistics and Metrics). Where regular neighborhoods of cells are involved such operations are termed focal, or if the neighborhoods are defined using pre-defined (irregular) zones, then the operations are described as zonal.

There are a large number of basic grid operations supported for image and general raster files. These include local, focal and zonal operations depending on the scope of the operation. Such operations may be applied to a single grid, or to a number of input grids, depending on the operation in question. The set of possible operations of this type are often referred to as map algebra. Originally this term was introduced by Tomlin (1983) as the process of map combination for co-registered layers with rasters of identical size and resolution. Combinations involved arithmetic and Boolean operations. A typical example would be the addition of separate grids for an area, where each grid cell represented the level of noise, L, due a particular source such as A: road, B: aircraft, measured or computed in the same manner. The total noise level for each cell would then be computed as the sum of the individual grid datasets, i.e. A+B+C+.., as described in Section 4.3.2, Simple calculations, and Figure 4‑36A. This is how grids such as that illustrated in Figure 3‑4 (Noise map, Augsburg) have been created. However the term map algebra is now used more widely by many suppliers. For example, ArcGIS describes the set of all operations performed using its Spatial Analyst option as “map algebra”. More specifically it divides such functions into five main categories:

Local functions, which include mathematical and statistical functions, reclassification, and selection operations

Focal functions, which provide tools for neighborhood analysis

Zonal functions, which provide tools for zonal analysis and the calculation of zonal statistics

Global functions, which provide tools for full raster layer or raster dataset analysis, for example the generation of Cost Distance rasters

Application functions, specific to tasks such as hydrology and geometric transformation

Similar facilities are provided in many of the mainstream raster-based GIS packages, such as PCRaster, TNTMips and Idrisi, and in the raster-processing toolsets of more generic packages such as GRASS. Many of these are described in greater detail in Chapter 6.

The map algebra concept is capable of being extended in several ways. One example is extension to explicitly handle the time domain coupled with 1, 2 or 3-dimensional spatial datasets. Mennis et al. (2005A, 2005B) have developed such a model and implemented a set of Java classes for handling what they describe as multidimensional map algebra (mma). Performance issues are one of the principal barriers to widespread use of such concepts, but as improved data structures and processing architectures emerge for spatio-temporal datasets, concepts of this kind are likely to be more widely applied. A second example of extension to map algebra ideas is map calculus, put forward by Haklay (2004, 2006). Haklay proposes retaining the functional form of surfaces to be combined, wherever possible, and performing operations on these forms rather than the resultant grids. For example, instead of generating a high resolution grid from a point dataset using some interpolation function, F(), one could retain the functional form F() and only generate the resulting grid as an output when required. This has the potential to provide a more manageable approach to spatio-temporal modeling than the mma procedure in some instances.