What is Map Algebra? [Raster Math]

Map Algebra

What is Map Algebra (Raster Math)?

Map algebra basically involves doing math with maps.

But the key difference is that it only applies to raster data. That’s why we also call it raster math.

First, let’s review the different types of map algebra.

Then, let’s practice with an example.

Types of Map Algebra

As you’ve learned, map algebra uses math-like operations. For example, you can apply simple math like addition or multiplication to update raster cell values.

The most common type of map algebra is a cell-by-cell function. This type has rasters directly stacked on top of one another. Then, the function applies to cells aligned with each other.

But you can also change the configuration so it’s not only cell-by-cell. Here are the types of map algebra operations that you can use:

  • Local
  • Focal
  • Zonal
  • Global

Let’s review how each type works.

1 Local Operations

Local Operation Raster

The simplest approach is map algebra on a cell-by-cell basis. For example, you have 2 rasters stacked on top of each other. Then, you add each cell one-by-one.

If raster cells represent temperature, you can subtract them both at different time periods. By using a local operation, you can find the difference in temperature for each cell.

Local Operation Example

2 Global Operations

Global Operation Raster

Global operations apply a bulk change to all cells in a raster. If you want to add a value of 1 to all grid cells, this is a global operation.

For example, Euclidean distance is an example of a global operation. By calculating the closest distance away from a source, it applies the function globally in a raster.

Global Operation Example

3 Focal Operations

Focal Operation Raster

Focal operations are spatial functions that compute an output value of each cell using neighborhood values. For example, convolution, kernel, and moving windows are focal operations.

MOVING WINDOW: A moving window is a rectangular arrangement of cells that shifts in position. By applying an operation to each cell from a moving window, it commonly smooths values in a raster.

Moving Window

4 Zonal Operation

Zonal Operation Raster

Zonal operations apply a math function to a group of cells within a specified zone. For example, a zone could be a vector or raster format.

If you want to find out how much rain is in a watershed, you can use a zonal operation. By using a raster with precipitation, you can set your zone as a watershed with a sum function.

Mathematical Functions

Here are examples of operations that you can use for map algebra:

  • 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)

Map Algebra Example

If you were to take a snapshot of land surface temperature in April 2015, it would look like this:

Land Surface Temperature April 2014

Then, if you took April 2014 land surface temperature, here’s what it looks like:

Land Surface Temperature April 2015

When you subtract April 2014 from April 2015 for land surface temperature, it shows the difference between temperature for two given periods.

Land Surface Temperature Difference

This is an example of a local operator because it subtracts each cell from one year to another. It’s also an example of an arithmetic operator because it uses subtraction.

Cells overlap with a range of -25° to +45°C. Then, we subtracted 2014 from 2015 land surface values for each cell. As a result, the output map has a range from -40° to +40°C.

What’s special about this is that you can pinpoint cells with the greatest difference. If values are positive, this means that 2015 land surface temperatures were hotter. But if values are negative, this means that 2015 land surface temperatures were colder.

Land Surface Temperature Subtraction

What happens when you have null values? Null isn’t a numerical value. If there are null values in any of the raster cells, they will remain as null in the output raster.

Map Algebra in ArcGIS

You can use map algebra in ArcGIS by using the Spatial Analyst tools. Now, let’s get hands-on experience using the raster calculator in ArcGIS:

First, enable Spatial Analyst extension.

Under ArcToolbox > Spatial Analyst Tools > Map Algebra, double-click the raster calculator tool

  • Select your raster data sets and operators
  • Set your function
  • Save as new raster layer

Raster Calculator

Relational Operators

Relational operators are logical functions that test a relationship. For example, here are operators that test logic:

Examples of relational operators are:

  • Equal to
  • Not equal to
  • Less than
  • Greater than

If it’s true, it returns a value of 1. But if it’s false, then it returns a value of 0.

Relational Operator

Statistical Operators

Statistical operators calculate statistics for each cell by using statistical functions. For example, minimum, maximum, average, or median are statistical operators.

You can really crunch numbers using tools like zonal statistics. This tool uses a statistical operator to evaluate numbers for all cell values within a zone.

For example, zonal mean, median, and minimum are tools that use statistical operators.

Data Citation:

Land Surface Temperature Data provided by NASA’s Earth Observatory Team, using data provided by the MODIS Land Science Team.

2 Comments

  1. I really love this and have applied this method in my thesis but i struggled to get where it was applied and I am now relaxed it is commonly used.

Leave a Reply

Your email address will not be published.


*