Map algebra
Map algebra is an algebra for manipulating geographic data, primarily fields. Developed by Dr. Dana Tomlin and others in the late 1970s, it is a set of primitive operations in a geographic information system which allows one or more raster layers of similar dimensions to produce a new raster layer using mathematical or other operations such as addition, subtraction etc.
History
Prior to the advent of GIS, the overlay principle had developed as a method of literally superimposing different thematic maps drawn on transparent film to see the interactions and find locations with specific combinations of characteristics. The technique was largely developed by landscape architects and city planners, starting with Warren Manning and further refined and popularized by Jaqueline Tyrwhitt, Ian McHarg and others during the 1950s and 1960s.In the mid-1970s, landscape architecture student C. Dana Tomlin developed some of the first tools for overlay analysis in raster as part of the IMGRID project at the Harvard Laboratory for Computer Graphics and Spatial Analysis, which he eventually transformed into the Map Analysis Package, a popular raster GIS during the 1980s. While a graduate student at Yale University, Tomlin and Joseph K. Berry re-conceptualized these tools as a mathematical model, which by 1983 they were calling "map algebra." This effort was part of Tomlin's development of cartographic modeling, a technique for using these raster operations to implement the manual overlay procedures of McHarg. Although the basic operations were defined in his 1983 PhD dissertation, Tomlin had refined the principles of map algebra and cartographic modeling into their current form by 1990. Although the term cartographic modeling has not gained as wide an acceptance as synonyms such as suitability analysis, suitability modeling and multi-criteria decision making, "map algebra" became a core part of GIS. Because Tomlin released the source code to MAP, its algorithms were implemented as the analysis toolkit of almost every raster GIS software package starting in the 1980s, including GRASS, IDRISI, and the GRID module of ARC/INFO.
This widespread implementation further led to the development of many extensions to map algebra, following efforts to extend the raster data model, such as adding new functionality for analyzing spatiotemporal and three-dimensional grids.
Map algebra operations
Like other algebraic structures, map algebra consists of a set of objects and a set of operations that manipulate those objects with closure. In this case, the domain is the set of all possible "maps," which are generally implemented as raster grids. A raster grid is a two-dimensional array of cells, each cell occupying a square area of geographic space and being coded with a value representing the measured property of a given geographic phenomenon takes one or more raster grids as inputs, 2) creates an output grid with matching cell geometry, 3) scans through each cell of the input grid performs the operation on the cell value, and writes the result to the corresponding cell in the output grid. Originally, the inputs and the output grids were required to have the identical cell geometry, but many modern GIS implementations do not require this, performing interpolation as needed to derive values at corresponding locations.Tomlin classified the many possible map algebra operations into three types, to which some systems add a fourth:
; Local Operators
; Focal Operators
; Zonal Operators
; Global Operators
Implementation
Several GIS software packages implement map algebra concepts, including PostGIS, ERDAS Imagine, QGIS, GRASS GIS, TerrSet, , and ArcGIS.In Tomlin's original formulation of cartographic modeling in the Map Analysis Package, he designed a simple procedural language around the algebra operators to allow them to be combined into a complete procedure with additional structures such as conditional branching and looping. However, in most modern implementations, map algebra operations are typically one component of a general procedural processing system, such as a visual modeling tool or a scripting language. For example, ArcGIS implements Map Algebra in both its visual ModelBuilder tool and in Python. Here, Python's overloading capability allows simple operators and functions to be used for raster grids. For example, rasters can be multiplied using the same "*" arithmetic operator used for multiplying numbers.
Here a modern MapAlgebra implementation, embedding map algebra expressions into SQL, see :
WITH foo AS (
SELECT ST_AddBand AS rast
SELECT
ST_MapAlgebra
FROM foo;
Here are some examples in MapBasic, the scripting language for MapInfo Professional:
slope = IncrementalGradient of altitude
- demo for Brown's Pond data set
- Give layers
- altitude
- development – 0: vacant, 1: major, 2: minor, 3: houses, 4: buildings, 5 cement
- water – 0: dry, 2: wet, 3: pond
- calculate the slope at each location based on altitude
toosteep = LocalRating of slope
- identify the areas that are too steep
where 1 replaces 4 5 6
where VOID replaces...occupied = LocalRating of development
- create layer unifying water and development
where water replaces VOID
notbad = LocalRating of occupied and toosteep
where 1 replaces VOID and VOID
where VOID replaces... and...
roads = LocalRating of development
where 1 replaces 1 2
where VOID replaces...
nearread = FocalNeighbor of roads at 0... 10
aspect = IncrementalAspect of altitude
southface = LocalRating of aspect
where 1 replaces 135... 225
where VOID replaces...
sites = LocalMinimum of nearroad and southface and notbad
sitenums = FocalInsularity of sites at 0... 1
sitesize = ZonalSum of 1 within sitenums
bestsites = LocalRating of sitesize
where sitesize replaces 100... 300
where VOID replaces...