## What is Map Algebra (Raster Math)?

You don’t need a **doctorate in mathematics** to do map algebra.

Because all you really need are at least **2 raster data sets** and a **math function**.

In a raster data set, each cell represents a value at a given location. A grid cell could represent anything – temperature values or precipitation volume.

The map algebra tool is a cell-by-cell combination of raster data layers stacked on top of each other. A simple operation like addition or multiplication are applied to each raster cell location. Map algebra generates a new raster output based on the **math-like expression**.

### Cell Configuration for Map Algebra

The simplest approach is performing map algebra on a cell-by-cell basis with two raster data sets. This is an example of a local operation.

But *cell configuration* can vary. Map algebra can be defined as **local**, **focal**, **zonal **and **global** operations:

### Local Operation

The value generated in the output raster is a function of cell values at the ** same location** on in the input layers. When you take the temperature average in each cell using two raster grids, this is an example of a local operation.

Here are examples of operations that can be used between the two raster layers:

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

### Global Operation

A global operation is a process or function that is performed on each output cell using ** all of the cells ** of the input raster.

For example, the Euclidean distance tool is an example of a global operation because it calculates the closest distance away from the closest source.

### Focal Operations

The focal operation is a spatial function that computes an output value of each cell using ** neighborhood values**. Convolution, kernel and moving windows are examples of image processing techniques that use focal operations.

A moving window is a rectangular arrangement of cells that applies an operation to each cell in a raster dataset while shifting in position entirely.

A neighborhood operation is a spatial function where the output location, area and extent comes from areas larger than and adjacent to the input cells. For example, average neighborhood operations smooth values in a map.

### Zonal Operation

A zonal operation is a spatial function that computes an output value of each cell using the ** zone containing that cell**.

An example of a zone could be a watershed. When you want to calculate the total mean volume of precipitation in each watershed zone, this is an example of when you would use a zonal operation.

### Map Algebra Example: Land Surface Temperature Change

NASA’s Land Surface Temperature rasters show how warm or cold Earth’s features (bare soil, snow or ice cover, cropland and forest canopy, etc) are during the daytime. Land surface temperature should not be confused with air temperature because land surface is the skin of the Earth.

Scientists want to measure global land surface temperature because it’s useful for understanding crop conditions, weather patterns and climate change. Moderate Resolution Imaging Spectroradiometer (MODIS) instruments measure the top 1-millimeter of the surface using thermal infrared.

**land surface temperature in April 2015**, it would look like this:

**April 2014 land surface temperature**, here’s what it looks like:

When you **subtract April 2014 from April 2015 for land surface temperature**, you see the difference in temperature everywhere in the world:

This is an example of an arithmetic local operator because each cell is being subtracted from one year by another. Using two raster layers, each grid cell had a value representing land surface temperature in 2014 and 2015. These grid cells overlapped each other and ranged from -25° to +45° Celsius.

We subtracted 2014 from 2015 land surface values for ** each cell**. As a result, the output map has a range from -40° to +40° Celsius. You can pinpoint cells with the greatest difference.

This is a local operation because the arithmetic function is being performed at the same location of each cell:

In the resulting layer, 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.

What happens when you have **null values**?

Null isn’t a numerical value. If there were **null values** in any of the rasters, they remained as null in the output raster.

### Performing Map Algebra in ArcGIS

Doing map algebra in ArcGIS is as if you are running any other geoprocessing tool.

In this section, you’ll uncover how to use the **raster calculator tool** in ArcGIS and get hands-on experience performing map algebra. Let’s get you started:

- Enable your
*Spatial Analyst*extension - Under ArcToolbox > Spatial Analyst Tools > Map Algebra, double-click the raster calculator tool
- Select your raster data sets and operators
- Save as new raster layer

### Other Map Algebra Examples

Here are some clear-cut examples that will help you connect the math-like functions with map algebra:

**RELATIONAL OPERATORS** is a logical function that tests a relationship and returns true *(as the value 1)* or false *(as the value 0)*.

Examples of relational operators are: equal to, not equal to, less than, less than or equal to, greater than and greater than or equal to.

If you use a “greater than 0” relational operator on a raster grid, the output raster grid will return the value *one *for all positive values and *zero* for all negative values.

**STATISTICAL OPERATORS** calculate statistics for each cell by using a statistical function such as minimum, maximum, average or median.

You can really crunch numbers using tools like zonal statistics. This tool uses a statistical operator to crunch numbers of all the cell values within a zone. Zonal mean, zonal median, zonal minimum – these configurations help GIS users for times in need.

All the cells within a zone have the same value for the raster output. In a zonal statistics output table, each row represents a unique zone.

### Data Citation:

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

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.

Thanks a lot. This was really useful