2. Learning objectives
• After this course you will be able to
• Understand different raster data types
• Use map algebra for geoprocessing
2
3. Map algebra
• Algebra for manipulating geographic data, developed in the
1980s by Dr. Dana Tomlin
• Set of primitive operations in a GIS allowing for 2 or more
raster layers of similar dimensions to produce a new raster
layer using algebraic operations
• Typically executed through a Raster Calculator, Command
Line or script.
3
4. Syntax for operators
• Syntax when using mathematical operators (+,-,*,/, etc.):
• Result = expression1 operator expression2
−operator: name of the operator
−expression1, expression2 are the arguments (i.e. inputs), these
can be:
−Maps
−Expressions resulting in a map (i.e. nesting of expressions is
possible)
−Result is the return value (i.e. what is created):
−One map
4
5. Syntax for operators
• Example 1: multiply two maps (for each cell), arguments are
maps:
• MapA = MapB * MapC
• Example 2: multiply two maps (for each cell), second
argument is another expression:
• MapA = MapB * (MapC + MapD)
5
6. Syntax for functions
• Syntax when using GIS functions:
• Result = function(expression1, expression2, …, expressionn)
−function: name of the function
−expression1, expression2, …, expressionn are the arguments
(i.e. inputs), these can be:
−Maps
−Expressions resulting in a map
−Result is the return value (i.e. what is created):
−One map (sometimes more)
6
7. Syntax for functions
• Example 1: calculate the slope of a Digital Elevation Model
(DEM):
• SlopeMap = slope(DEM)
7
8. Types of operations
• Local or point operations
• Focal or neighbourhood
operations
• Zonal or area operations
• Global or map operations
8
9. Local operations
• Independent of the property
of neighbouring cells (i.e. no
relations in lateral direction)
• A new map is generated on a
cell-by-cell basis
9
11. Focal operations
• Relates cells to its neighbours
• Different types:
1. Window operations
2. Flow direction operations
3. Friction path operations
4. Transport of material over flow
direction map
5. Visibility analysis
11
13. Zonal operations
• cell value is determined on
basis of values of cells which
are in the same area as the
cell under consideration.
• aggregation of cell values over
units of cartographic space
(areas)
13
15. Global operations
• computes one non-spatial
value as a function of existing
cell values of cells associated
with a map
• value is determined on basis
of all cells in a map
15
17. Boolean operations
• Boolean maps contain 1
(TRUE) and 0 (FALSE):
• Yes/No
• Suitable/Unsuitable
• Visible/Not visible
• Boolean operators result in a
boolean map:
• AND
• NOT
• OR
• XOR
17
and expression1 Result
expression2 True True True
expression2 True False False
expression2 False True False
expression2 False False False
or expression1 Result
expression2 True True True
expression2 True False True
expression2 False True True
expression2 False False False
xor expression1 Result
expression2 True True False
expression2 True False True
expression2 False True True
expression2 False False False
18. Raster calculations and NODATA
• For some functions boolean with TRUE and FALSE has a
different meaning than a map with TRUE and NODATA
• Example: distance calculations calculate the distance from
NODATA cells to the cells with a value. So if there are zeros,
the resulting map contains only NODATA
• Every map algebra operation with NODATA in one input map
results in NODATA in the output map.
18
19. Acknowledgments
• The map algebra illustrations were taken from the PCRaster
documentation: http://pcraster.geo.uu.nl with permission
from the Department of Physical Geography, Faculty of
Geosciences, Utrecht University, the Netherlands
19