Unit 42 - Using Map Algebra

Contributed by: Chris Allen, The Clark Labs, Clark University

 

Context

Map Algebra is one kind of derivative mapping; new data layers are derived from existing data layers through combination and transformation. A GIS typically provides tools for combining and/or transforming map layers mathematically. We might find that this is necessary because an analysis we are conducting requires that data values for one or more data layers be numerically processed and/or combined according to some formula or equation. For example, if we have an equation that predicts temperature as a function of altitude, we may wish to derive a temperature map from a digital elevation model. Or, as another example, consider the possibility of creating a soil erosion potential map given data layers of soil erodability, slope, and rainfall intensity and an equation relating soil erosion to these three factors. Clearly we need the ability to modify data values in our map layers by various mathematical operations and transformations and to combine factors or data layers mathematically to produce a final result.

More Discussion on Map Algebra (including graphics)
 


Learning Outcomes

Awareness

Students will understand:

- that Map Algebra allows one to use GIS data layers as variables in algebraic/mathematical expressions

- why there is a need for transformation of data layers to provide proper input to a model (e.g., by scale or range-of-data-values conversion) or for applying a model to analyze data.

-that combination of data layers is a powerful tool for derivation of new data layers.

- the difference between applying a scalar, a function, or another data layer to a data layer to create a new output layer.
 

Competency

Students will understand:

-how to perform each of the three types of data layer transformation: data layer with scalar, data layer with function, and data layer with data layer.

-how a mathematical equation can be implemented using a sequence of Map Algebra steps to derive an analytical result.
 

Mastery

Students will be capable of:

- working back from a desired outcome or given equation to determine the sequence of data layer manipulation steps required to derive a desired data layer result.
 


Example Application

Imagine that we have a simple model for estimating runoff from an area and we wish to apply it to a study area to estimate the total runoff in a precipitation event. The equation for the model is:

(S * C * P)/160 = R

where:

* indicates multiplication, / indicates division,

S = the surface slope, categorized into values of 1 (0 to 3 degrees), 2 (3 to 6 degrees), 3 (6 to 9 degrees), or 4 (greater than 9 degrees),

C = ground cover coefficient, a value of 10 for dense, broad leaf cover, 20 for grass or mixed coniferous forest, 30 for sparse canopy forest, and 40 for bare ground,

P = Precipitation in millimeters, and

R = Runoff volume of water, in liters per square meter

We start with the following data layers, each has 201 rows by 201 columns; each cell covers a 20-meter by 20-meter portion of the study area:

Categorical slope image, containing values from 1 to 4

Ground Cover for our study area, containing values of 10, 20, 30, and 40:

Precipitation for our study area for a particular rainfall event, values range from 12 mm to 22 mm:

In order to perform our analysis, we first overlay-multiply our slope category image times our ground cover category image. This overlay-multiplication step creates a new image in which each cell contains an attribute value equal to the multiplication product of the two corresponding cells in the input images:

We take this image, which resulted from the first overlay step and overlay-multiply by our precipitation image to produce this image:

Next we perform a scalar operation. We divide this image by 160 to produce this result:

For each cell in our raster data layer, we have estimated the amount of runoff in liters per square meter. Each cell covers an area of 400 square meters. We can transform this data layer from representing liters per square meter to liters per cell by performing a simple scalar multiplication of this data layer times 400.

For example, if a particular cell in our resulting image above has an attribute value of 15.2 liters per square meter, then the total runoff for that cell is:

15.2 liters per square meter X 400 square meters = 6080 liters.

An image is not provided to show the result of the scalar multiplication of the raster result above (Runoff in liters per square meter) times 400 because the image looks identical. The only difference is that the attribute value in each cell in the new image (Runoff in liters per cell) is 400 times larger than the value in the image above.

If we wish to compute the total runoff in our study area, we need to sum the attribute values in all of the cells in our raster (Runoff in liters per cell). This is a fundamental type of database query operation, and the capacity to perform this analysis is likely to be found in any robust GIS. In Idrisi, an easy way to sum up all of the attribute values in an image is to create a "blank" raster - an image containing one value, zero, for instance. This blank raster has the same number of rows and columns, spatial extent, and reference system as the rasters we have been working with. Next we use the EXTRACT module specifying that the "blank" raster is our Feature Definition Image, and the image we wish to sum is our Image To Be Processed. Specify the SUM option of EXTRACT to add up the attribute values for all of the cells in the raster. The EXTRACT module sums (if we choose the SUM option) the values in all of the cells which underlie each value category in the Feature Definition Image when it is placed over the Image To Be Processed. In this case we have only one value category (zero) throughout our blank raster, the Feature Definition Image. Therefore the attribute values for the entire image are summed to produce a value of 81,378,400 liters for the entire study area for this precipitation event.
 
 


Preparatory Knowledge/Skills

Recommended:

1. Background Materials: What is GIS?

2. Unit 22: Merging Tabular Data with Spatial Data

3. Unit 34: Types of Overlay Operators

4. Unit 41: Using Boolean Search Techniques
 

Complementary:

1. Unit 19: Planning a Tabular Database

2. Unit 28: Editing Raster Data

3. Unit 43: Using Derivative Surface Operators

4. Unit 44: Using Hydrologic Models
 


Awareness

Learning Objectives:

1. Student can define basic vocabulary relating to Map Algebra.

2. Student can explain the differences between mathematical application of a scalar, a function, and a data layer.

3. Student can describe why Map Algebra operations are performed on the actual data values in a raster or in a database for a vector GIS.

4. If software will be used, students can describe the software steps used to conduct Map Algebra using a scalar, a data layer and a function.

5. Student can give an example of each of the three types of operation.

6. Student understands the special case when two data layers are multiplied and the second contains only zeroes and ones. This has the effect of "masking out", i.e., converting to zero, the areas in the first data layer which correspond to zero areas in the second, while leaving attributes in the areas corresponding to ones unchanged.
 

Vocabulary

Map Algebra

Scalar

Function

Overlay
 

Awareness Topics

- Map Algebra is used to transform or derive new data values from one or more existing data sets.

- The spatial extent of the data layers is not altered in Map Algebra.

- In a vector system, in which attributes are stored in a database, Map Algebra using a scalar or a function involves transformation of the attribute values in the database. These are commonly written to a new field in the database.

- In a vector system, Map Algebra in which a data layer is combined with another data layer can produce a new data layer in which derived features may have different sizes and or shapes than in either input layer. For example, a data layer in which polygons represent areas suitable for development, with attribute values ranging from 0 (unsuitable) to 1 (most suitable) could be multiplied by a data layer in which preference for development was also depicted as polygons with attribute values between 0 and 1. By multiplying these two data layers together, we can produce some composite probability of development image. It is important to note that we might find that our output polygons differed in size and shape from the polygons in either of our input images (Figure 5).

- In a raster system, sizes and extents of individual cells are not altered by application of a scalar, a function, or another data layer, but the sizes and shapes of features (collections of cells, generally with the same single value) depicted in the result may differ from the sizes and shapes of features in the input. For example, one could have a raster image in which each pixel value is the average slope for that pixel, and one could have another image where the attribute value of each pixel is the soil erodability of that pixel. If the two images are multiplied together one can derive a simple erosion risk map. In this resulting image, the features, i.e., the areas of high erosion risk, intermediate levels of risk, relatively lower risk, or whatever way the output values are categorized, will have shapes and sizes which differ from features (areas of constant erodability or areas of constant slope) in the input images.

- If software is being used, the student should know what Map Algebra operations are available, and how they can be invoked.
 


Competency

Learning Objectives:

1. Student will be able to invoke the necessary software options to transform data attributes by combination with a scalar, a function, and another data layer.

2. Student will demonstrate the capability to perform a sequence of Map Algebra steps to conduct an analysis described by a mathematical equation.

3. Students will be able to explain why combination of data layers is likely to produce a resulting data layer in which the sizes and shapes of features differ from the input layers, whereas when a scalar or function is applied to a data layer, the resulting features have the same geometry as the input layer.
 

Generic List of Tasks

1. Perform a scalar operation for unit conversion:

In a raster system, multiply the elevation values in feet in the input layer by 0.3048 to produce a new data layer containing elevation values in meters (or transform from meters to feet by multiplying by 3.28).

In a vector system, transform the line attributes for an elevation contour layer, by multiplying by 0.3048 to transform the line attributes from elevation units of feet to units of meters.

2. Apply a simple mathematical function to a data layer, e.g., square the attribute values in a raster or vector.

3. Combine two data layers to produce a result:

Raster: multiply urbanization factor map by travel time per cell

Vector: multiply property values by appreciation coefficient map; public properties have one value of appreciation, private properties have a different value.

4. Perform a sequence of Map Algebra steps to interpret an equation, e.g., raster: estimate precipitation given a temperature map (degrees f) and an elevation map (m) using an equation such as precip(mm) = (ln(temp(deg K)) * (elev(m)/250))
 

Example Implementation: Estimating the Number of Pets in a Region to Evaluate Suitability for an Animal Hospital

 

Mastery

Learning Objectives:

1. Student will understand how to start with an algebraic expression, determine what data layers are needed, transform the data layers to proper units if necessary, and combine the data layers to conduct an analysis which interprets the algebraic expression.

2. Student will understand how layer multiplication by second layer containing only attributes of zero and one can be used to discriminate features of interest or to mask features to be omitted from further analysis.

3. If vector software is used, student will understand how combination of two data layers containing features whose geometry differs between the two layers can produce a new data layer whose features differ in shape from features contained in both input layers.
 

General Tasks (see Example Implementation)

Example Implementation: Determining Potential Wind Power

 

References:

Nelson, Vaughn, Earl H. Gilmore, Kenneth Starcher, 1994, Introduction to Wind Energy, Alternative Energy Institute, West Texas A & M University, Canyon, Texas

Rohatgi, Janardan S., Vaughn Nelson, 1994, Wind Characteristics: An Analysis for the Generation of Wind Power, Alternative Energy Institute, West Texas A & M University, Canyon, Texas
 


Follow-up Units

1. Unit 21: Using Spreadsheets

2. Unit 22: Merging Tabular Data with Spatial Data

3. Unit 31: Managing Database Files

4. Unit 33: Using Buffering Operators

5. Unit 34: Using Overlay Operators; Pre/Post-Overlay Tasks
 


Resources:

Idrisi Resource Center Salzburg: Idrisi Tutorial
 

Acknowledgements

The author wishes to thank Michele Fulk of Clark Labs and the Clark University Cartography and Information Graphics Service for the invaluable assistance they provided in the preparation of this unit.  Michele Fulk offered expert advice and editorial assistance. The Clark University Cartography and Information Graphics Service created the concept graphics for the unit.


Back To Core Curriculum for Technical Programs Welcome Page

Currently maintained by Steve Palladino
Created: May 14, 1997. Last updated: October 5, 1998.
Content comments to Chris Allen
Formatting comments to Steve Palladino