Masthead>
Header

Raster Analysis and Raster Math

Introduction

Raster Analysis is a general term for spatial analysis conducted using raster data. With raster analysis you can derive new information by transforming or making associations from existing raster layers. One of the most powerful things we can do with rasters is run mathematical operations on them. You can create complex expressions using the mathematical functions. Examples include probability predictions based on a variety of inputs, habitat selection and fire hazard probability. There are a variety of functions we can apply to the pixels in a raster. Raster Math treats raster layers as part of algebraic expressions known as Map Algebra or Band Math. In ArcGIS the “Raster Calculator” tool executes Map Algebra expressions and in ENVI the “Band Math” tool allows you to do simple functions and calculations.

Mathematical Operators

Basic arithmetic operators allow for addition, subtraction, multiplication, and division (+, -, *, /) of rasters. The raster math is applied on a raster on a pixel by pixel basis. Expressions can include just one raster layer or many raster layers.

Single Raster Example: We have a DEM (Digital Elevation Model) raster layer where the value of each pixel represents the elevation in meter and we want to convert it to feet and there are 3.281 feet per meter.
Raster Calculator Expression:
"DEMRaster" * 3.281 = Output Raster DEM in feet

Below is an example of raster math using multiple rasters. In this example Raster 2 is subtracted from Raster 1 and the output raster values represent the difference between the rasters. We have actually already employed this approach in Lab 9 when we calculated the difference Normalized Burn Ratio to determine burn severity. Any change in values can be calculated using the same method.

Raster Math

Mathematical Operators

There are a variety of other mathematical operators that can only be applied to one input (raster). These tools perform various types of exponentiation operations, including exponentials and logarithms. There are also tools that are used either for sign conversion and for conversion between integer and floating point data types. Examples:

Comparison Operators

We can execute "comparisons" between two rasters and the result will be a "boolean" or binary raster. The comparisons include; equals ("="), not equals ("!="), less than ("<"), greater than (">"), less than or equals ("<="), and greater than or equals (">="). The result of a comparison is a "Boolean" or binary value which can only be "true" or "false". "True" is set inside the computer as a one while "false" is a zero. You can refer to boolean values as true or false or as 1 or 0. Either is correct and common.

Example: Using a DEM we want to find areas where the elevation is greater than 500 m.
Raster Calculator Expression: "DEMRaster" > 500

Boolean Operators

Boolean operators allow us to find rasters where one raster contains "true" values (or 1) AND the other contains "true" values. An example would be finding where there is habitat for wolves AND habitat for deer. We can also find where one raster contains "true" values OR the other contains "true" values. Boolean operators include AND, which specifies a combination of conditions (A and B must be true); OR, which specifies a list of alternative conditions (A or B must be true); NOT, which negates a condition (A but not B must be true); and XOR (exclusive or), which makes conditions mutually exclusive (A or B may be true but not both A and B). At least two inputs are necessary for Boolean evaluation to take place.

Example: We want to find areas where the elevation is greater than 500 m but less than 1000 m and the Land Class type is equal to Urban.
Raster Calculator Expression: ("DEMRaster" > 500) & ("DEMRaster" < 1000) &("land class" ==23)

Raster Calculator in ArcGIS

The Raster Calculator in ArcGIS allows you to create and execute a Map Algebra expression that will output a raster.

Band Math Tool in ENVI

The Band Math tool in ENVI can be used to apply mathematical operation, or custom function to one or more bands in an image. All variables in the Band Math expressions must be named "Bn" or "B1" for example. The bands or files assocated with each band are defined during the Band Math tool operation. For complex operations, ENVI allows for the saving of mathematical expressions to a file for future use.

Explore the ENVI Band Math Operations »

Band Math ENVI

← Back

Next →

Module Home