25 Map Algebra

Dr Dinesh Kumar

 

CONTENTS

 

1.  Learning Objectives

 

2.  Introduction

 

3.  Significance of Map Algebra

 

4.  Working with map algebra

 

5.  Summary

 

6.  References

 

 

1. Learning Objective

 

To understand the concept of map algebra in GIS and its application in decision making process

 

2.  Introduction

 

Spatial feature of earth surface can be easily mimicked in significant way virtually by means of Geospatial technology or GIS technology. Any particular detailed representation of a earth’s surface feature or phenomenon can be termed as spatial data which can be represented many ways such as vector or raster data models. Spatial data being explicit in nature makes its central role in GIS techniques by improving the capacity of editing, analysis and modeling of GIS technique. The analytical and modeling potential of GIS helps in solving complex planning and management problems.

Figure1. An illustrative diagram of spatial system.

 

Representation of spatial data in either vector or raster format in GIS platform may have its own pros and cons but will serve specific purpose. The gridded and continuous structure of raster data provides an edge to apply a number of mathematical and other techniques on raw raster data generating a number of derived analytical variables/parameters. These derived variables might have substantial information for the said region which can become a significant tool for decision support system. For example, spatial data for vegetation or water body for two times of a region can provide nearly a very good assessment of deforestation or water shrinking or flooding situation.

Fig-2: Diagrammatic representation of mathematical operation on two sets of spatial data to derive new spatial information data set.

 

Derived spatial information using a set of spatial data can have significant potential application not only in spatial phenomenon but in non-spatial phenomenon also existing in the region. These capabilities of GIS technology had evolved exponentially through time in terms of technical and computational growth. A lot of tools and techniques had designed and tested for spatial analyst.

 

Map algebra is one of the spatial analyst technique used for manipulating, deriving and modeling purpose using a set of raster data. Or We can understand map algebra a powerful tool which can perform a set of mathematical operation on cell-by-cell of a set of raster data. After performing the mathematical operation, map algebra creates a new raster data based on math-like expressions.

Figure-3: Representation of working flow of a mathematical operation using Map algebra tool. Image

source: www.esri.com

 

It is also known as cartographic modeling. By use of tools, operators and functions map algebra become simple and powerful algebra and applied on raster data to achieve many informative results.

 

3. Significance of Map Algebra

 

A variety of spatial information of earth and its atmosphere can be imported on GIS platform in a number of ways. This information can be further processed using map algebra on GIS platform to derived parameters or variables about earth and its other components which can become a early warning system, hazard zone and decision support system for planners in field of agriculture, population, urban planners. Looking into the power of map algebra through mathematical function, creative domain of GIS field might emerge as integral part of processing and modeling of huge data set pertaining to earth and its different components.

 

 

4. Working with Map algebra

 

It is a script language designed for manipulation of input data in form of spatial analyst in various GIS packages. In many packages like ARCGIS, it named as raster calculator. Map algebra uses simple syntax like algebra taking input/inputs and resulting into modified output. Inputs can be single raster data set, raster layer, feature data set or shapefile. Map algebra acts as a strong tool in manipulation spatial data. Manipulation can be done by applying mathematical function on of each location’s values and can be applied to a series of inputs as well.

 

In order to understand map algebra properly, we need to understand its different components as explained below.

 

Important component of map algebra can be understood under following sub-topics

  • values
  • operators
  • function

Inputs are the very first things on which map algebra operates. Therefore inputs become values for map algebra for further processing.

 

Mathematical expressions like sum, subtraction or multiplication, transform the input into resulting output and therefore is termed as operator. Values and operators are also explained in figure-3 where cell values of two different (can be same also) rasters are summed up cell by cell resulting in new raster dataset. Here cell values are values and mathematical function, sum, is operator.

 

Map algebra operators include a range of mathematical function which is explained further. Typically the operators are categorized into following subcategories:

  • Arithmetic Operators
  • Comparison and logical operators
  • Conditional Operators

 

4.1 Arithmetic Operators: Map algebra allows various arithmetic expressions like sum, multiplication, divide and subtraction. These mathematical expressions can have inputs of raster and constant values or raster and raster grids.

 

4.2 Comparison and logical operators: Comparison and logical operators within map algebra includes

Comparison operator can be understood by taking an example. If the resultant raster grid values is calculated as

 

Resultant Raster: = Input Raster1 < > Input Ratser2

 

The resultant raster grid cell will store the values which will fulfill the above condition i.e. it will take only those input cell values of input rasters which are not same (True) and same grid values of input rasters will be considered as false condition. Like this the resultant raster will store the true and false assignment using the input rasters.

Fig-4: Logical Expressions in Map algebra. Green cell represents true values and white cell represents false values. Source: e-book, principles of GIS, An Introductary Textbook, ISSN 1567-5777

 

Logical and comparison operation is diagrammatically explained in fig-4 where true and false values were calculated using comparison operator using inputs and logical operators make a decision based on provided conditions. The logical operators have been explained in little more detail (complex logical operator) the fig-5 where a condition is evaluated against a value i.e. forest cover (F) against elevation (value) or in other words logical outcomes for the criteria of forest search at different elevations.

 

Fig-5: Complex Logical Expressions in Map algebra. A represents classified raster for land use and B elevation values. Source: e-book, principles of GIS, An Introductary Textbook, ISSN 1567-5777

 

4.3 Conditional Operators

 

Conditional expressions have proved to be very useful in multiple criteria decision. By providing certain criteria, surprising outcomes can be achieved. Logical and comparison operations provide true or false values but testing these statements, conditional expressions is required. Typically the conditional expression is written as:

 

Output_Raster:= CON (Condition, then_expression, else_expression)

 

Here condition is the tested condition; then_condition is evaluated if condition hold, else_condition is evaluated if it does not hold.

 

The conditional expression CON (A= “Forest”, 10, 0) tells that input forest pixels will be assigned a value of 10 in output raster. And a value of 0 will be assigned where the forest pixels do not exist (false Value). Another example can be taken where suitability analysis is done using landuse class and geology of the region.

 

Suitability= CON ((Landuse= “Forest” AND Geology= “Alluvial”) OR (Landuse= “Grass” AND Geology=”Shale”), “Suitable”, “Unsuitable”))

 

Fig-6: Conditional Expressions in Map algebra. A represents classified raster for land use and B elevation values. Source: e-book, principles of GIS, An Introductary Textbook, ISSN 1567-5777

 

Fig-7: Conditional Expressions in Map algebra to find out suitability analysis. Source: e-book, principles of GIS, An Introductory Textbook, ISSN 1567-5777

 

Functions are more defined but little complex in map algebra which needed to be explained in detail. Function(s) defines specificity and region of operators being applied on raster data or datasets. On the basis of requirement, functions can extract or generate at cell to cell level information or focal information like min, max or information regarding a particular zone. Therefore it can be said in general that nature of analysis controls the functions specificity.

 

So in more precise the functions in map algebra can be categorized into:

  • Local functions
  • Focal functions
  • Zonal functions
  • Global functions

More importantly, these functions can be applied to one or multiple raster datasets.

 

4.4 Local functions

 

When an operation is processed at each individual cell value of raster data set(s), the function is termed as local function. It considers top left cell as initial cell value input and proceeds. The output raster cell value thus generated is a function of cell values at the same location which was in the input layers. For example: If the provided raster of pressure data is in Pascal, it can be converted into hPa by multiplying by a constant number i.e. dividing each cell value by 10 (Constant value multiplication) or averaging two raster datasets of temperature of two different times (Multiplier Grid multiplication).

Fig-8: Map algebra local function using Grid and constant value multiplier

 

 

From the explained example, it is pretty clear that a number of mathematical operations can be applied on raster data set(s). Most of the functions are local in nature. The mathematical operations which are considered for local function are:

  • Arithmetic operations (addition, subtraction, multiplication, division)
  • Statistical operations (minimum, maximum, average, median)
  • Relational operations (greater than, smaller than, equal to)
  • Trigonometric operations (sine, cosine, tangent, arcsine)
  • Exponential and logarithmic operations (exponent, logarithm)

 

4.5 Focal Functions

 

If kernel (matrix) moves over the entire data and recalculates the each grid value by considering the neighboring cell value of input raster, the function(s) is termed as focal function. Such functions are used to enhance a particular kind of information of a dataset such as boundary information among different earth features (water-land, forest-settlement boundaries) or other kind of analysis.

Fig-9: Map algebra focal function using 3×3 Karnel to recalculate the output grid cell value

 

Focal function can be understood by examples given in fig-9. The central cell of 3×3 kernel or matrix starts rolling over top left cell of the raster data and recalculates the resultant cell values. So the top left cell has been assigned as grid-cell no-1 and horizontally next to it as grid cell no-2 and so on. The process of recalculating the resultant value using sum karnel is explained below.

 

Raster data grid-cell-1 has value of 25 along with cell values of 26, 27 and 28 as neighboring grid-cell. The center grid-cell of karnel would be at the place of raster grid-cell no-1. So the recalculated grid cell-value for resultant grid-cell no-1 would be

 

(Target Raster Grid-cell-value × Karnel Central-cell-value)+ (Neighboring-cell-value) × (Respective karnel-cell-value)

 

Like this the recalculated grid cell-value for resultant grid-cell No-1 is

 

(0×25)+ (1×26) + (1×27) + (1×28) = 0+26+27+28=71

 

There is only three-neighboring grid-cell for top-left grid-cell as it is at corner-cell. Likewise, the recalculated grid cell-value for resultant grid-cell No-2 is

 

(0×26)+(1×28)+(1×26)+(1×27)+(1×28)+(1×25)=0+28+26+27+28+25=154

 

As the grid-cell lies far from corner, the number of neighboring grid-cell increases up to a maximum of eight (8). Similarly, the recalculated grid cell-value for resultant grid-cell No-12 is

 

(0×27)+(1×28)+(1×26)+(1×27)+(1×29)+(1×26)+(1×28)+(1×25)+(1×26)=0+28+26+27+29+26+28+25+26=215

 

There is different kind of karnel working as mean karnel, average karnel, directional karnel and inward outward karnel.

 

4.6 Zonal functions

 

A thematic class like Building, watershed, forest etc is considered as a zone where each cells hold same values irrespective of float or integer in nature. Zonal functions are extension of focal functions where neighborhood is defined by zones not by a specified neighborhood shape. If particular kind of information enhancement technique is applied over zone using the karnel or other spatial filters, it is termed as zonal function. It is a spatial function which is used to calculate the output cell values using the zone containing that cell. It can be better understood by taking the example of a zone of a watershed. Zonal function can be used to calculate the total mean volume of precipitation in each watershed zone. Zonal mean, zonal max, zonal sum, and zonal variety are general types of zonal function.

 

Fig-10: Map algebra zonal function using  (a) zone dataset and (b) value raster to calculate the zonal mean output raster. Source: ArcGIS Help mannual

 

4.7 Global function

 

If the each output raster cell-value is a potentially function of cells combined from input rasters. To process such kind of operations, global function is required. Euclidean and cost (or weighted distance) functions are two groups of global functions. Euclidean distance is estimated from the center of the source cells to the center of each of the surrounding cells. In other words we can say that the output value of each cell is a function of the entire input raster grid. Generally the global functions are applied in distance measurement, flow directions and weighting measures.

Fig-11: Map algebra Global function: Calculating the Euclidean distance from a raster cell to its nearest source cell. Source: ArcGIS Help manual

 

5. Summary

Geospatial technique has evolved as an integrated science tool which is being used in various fields now a day. The most exciting technique within GIS which offers a range of analytical capability is map algebra. This script based technique is applied using operators and functions resulting in more precise and useful outcomes. Operators and functions together make this technique very unique as it can handle many input criteria. While arithmetic operators provide basic mathematical capability, comparison and logical operators gives more wings to generate qualitative outputs. Adding more capability, conditional operators take many criteria or considers decision table (quantitative and qualitative) for multi-criteria analysis. On the other hand functions allow the operators to work at local, focal, zonal or global level. Map algebra has advanced more in recent years adding more functionalities depending on requirement as the domain of GIS widens. Be it forestry, urban planning, agriculture or atmospheric science, map algebra provides a scientific solution based on available inputs which serves as decision making support system.

 

  1. References
  • desktop.arcgis.com/en/arcmap/latest/…/spatial…/map-algebra/what-is-map-algebra.htm
  • e-book, Principles of GIS, An Introductory Textbook, ISSN 1567-5777
  • gisgeography.com › GIS Analysis
  • https://www.nrem.iastate.edu/files/w11-MapAlgebra_presentation5.pdf
  • https://support.esri.com/en/other-resources/gis-dictionary/term/map%20algebra