Reclassifying raster values into classes
Turn continuous raster values into classes with a reclassification table, for example elevation zones, and count the cells of each class.
You will learn
- Write a reclassification table.
- Handle boundaries and unmatched values.
- Read class counts from the result.
Prerequisites
Data for this tutorial
DEM 30 m (synthetic) Download dem.tif
- Format
- GeoTIFF, 1 band, Float32
- Geometry
- Raster, 560 × 480 cells of 30 m
- CRS
- EPSG:32643 (WGS 84 / UTM zone 43N)
- Content
- Elevations 450.01 to 678.95 m; NoData -9999 in the south-west corner
- In Orbis
- Browser panel ▸ Tutorial sample data (synthetic) ▸ DEM 30 m, or Load complete tutorial pack.
Licence: CC0 1.0. All tutorial data is synthetic and generated by Orbis. About the datasets
The task
You want three elevation zones from the DEM: low (up to 500 m), middle (500 to 600 m) and high (above 600 m).
Steps
- Add DEM 30 m from the tutorial data.
- In the Toolbox, open Reclassify by table and choose the DEM as Input raster.
In Reclassification table, click Add rule three times and fill in the rows (an empty From or To means no limit; From is inclusive, To exclusive):
From To New value (empty) 500 1 500 600 2 600 (empty) 3 
Three elevation classes in Reclassify by table.
- Leave Max values are inclusive unticked (a value of exactly 500 goes to class 2) and keep Unmatched values at Set to NoData. Under Advanced parameters, set Output data type to Byte (UInt8) and Output NoData value to
0. Click Run.
- Style the result with Single-band classified. To count the cells of each class, run Raster histogram on the result with Number of bins
3; the table in the Processing log has one row per class.
Expected result
A Byte raster with values 1, 2 and 3: 85,321 low cells, 150,166 middle cells and 31,543 high cells; the 1,770 NoData cells of the DEM stay NoData. Each 30 m cell is 0.09 ha.
Common mistakes
- Overlapping ranges. With Max values are inclusive ticked, a value equal to a boundary belongs to the lower class; unticked, to the upper class. Decide once and keep it.
- Class values that equal NoData. Do not use the output NoData value (here 0) as a class value.
Troubleshooting
- Many NoData cells. Values outside all ranges become NoData when Unmatched values is Set to NoData. Extend the ranges or keep the original values.