Skip to content
← Back to Spatial Analysis
spatial-analysisIntermediate· 5 min read

Raster Analysis and Map Algebra: Reclassify, Combine and Summarise

How local, focal, zonal and global operations work on a grid of cells, how to reclassify and combine rasters, and what to check before you trust the output.

What is a raster?

A raster is a grid of cells. Each cell has one value, and the grid has a known cell size and position on the Earth. Satellite images, elevation models, temperature surfaces and classified land cover maps are all rasters.

Some cells have no value, for example where a cloud hid the ground or where a layer does not reach. These hold a special NoData value. NoData is not zero. A zero is a measurement, and NoData means there is nothing to measure.

What is map algebra?

Map algebra is arithmetic and logic applied to cells. The term comes from the geographer Dana Tomlin, who grouped the operations by which cells they use.

FamilyCells used for each output cellExample
LocalThe same cell in one or more rastersNDVI from the red and near-infrared bands
FocalThe cell and its neighboursA 3 by 3 smoothing filter, or slope from an elevation model
ZonalAll cells inside a zone, such as a polygonThe mean temperature of each park
GlobalThe whole rasterThe distance from every cell to the nearest road

Reclassification

Reclassification replaces ranges of values with class codes. It turns a continuous raster into a map you can count and compare. A vegetation index can become four classes: water and built-up, sparse, moderate and dense vegetation. The class breaks are your decision, so base them on the histogram and on a visual check against imagery, and write down why you chose them.

Combining rasters

Two ways to combine rasters appear again and again.

Boolean overlay uses tests that return 1 or 0. Cells that were dense vegetation in 2020 and are not in 2025 can be found with a test on both dates, and the result is a mask of loss.

Weighted overlay multiplies each raster by a weight and adds them. The input rasters need to be on the same scale first, such as 0 to 1, and weights usually add up to 1. The site suitability note covers this in more detail.

Zonal statistics

Zonal statistics summarise a raster inside each polygon, for example mean NDVI for each park. The tool counts a cell when its centre falls inside the polygon, so a small polygon may contain only a few cells and give an unstable mean. Look at the count column and treat polygons with very few cells carefully.

What must match

Cell-by-cell tools need rasters that line up. Before combining two rasters, check that they share:

  • the same coordinate reference system
  • the same cell size
  • the same extent and alignment of cell edges

If they do not, resample one to match the other, ideally once and from the original data. Resampling a raster again and again blurs values.

Example: vegetation change

The QGIS tutorial calculates NDVI from Sentinel-2 imagery for March 2025 and March 2020, using the same bands and the same scale. Subtracting one from the other shows where vegetation changed. A reclassified version marks drops of 0.2 or more as loss. Comparing two dates from the same time of year keeps the seasons from creating false change.

Common mistakes

  • Combining rasters that do not share a grid.
  • Treating NoData as zero in an average.
  • Dividing integers and getting integer results when decimals were needed.
  • Choosing class breaks without looking at the histogram.
  • Comparing dates from different seasons and calling the difference land change.
  • Reading zonal means for tiny polygons as reliable.

Glossary

TermMeaning
RasterA grid of cells, each with a value
NoDataThe value that marks a cell with no information
Map algebraOperations on raster cells, grouped as local, focal, zonal and global
ReclassificationReplacing value ranges with class codes
Zonal statisticsSummaries of a raster inside zones such as polygons
ResamplingRecomputing a raster onto a different grid

Practise it

The tutorial Raster analysis: reclassify, overlay and zonal statistics runs these steps on Sentinel-2 NDVI for Bengaluru.

Test yourself

1. Why is NoData different from zero?

Zero is a real measurement. NoData means no value was recorded. Treating it as zero lowers averages and creates false results.

2. Which family of map algebra gives the mean value of a raster inside each polygon?

Zonal operations.

3. What three properties must two rasters share before you combine them?

The coordinate reference system, the cell size, and the extent and alignment of the cells.

Quick quiz

1. NDVI is calculated from the red and near-infrared values of the same cell. Which family is this?
2. A smoothing filter averages each cell with its eight neighbours. Which family is this?
3. Why is zonal mean NDVI unreliable for a very small park?
0 of 3 answered

Key takeaways