Terrain ruggedness and position
The terrain ruggedness index, topographic position index, and roughness for the center of a 3 x 3 elevation window.
Experimental: not yet fully verified. How results are checked
Ruggedness is 2.474 m by Riley, or 0.775 m as a mean difference, and the cell sits below its neighbours: a valley, a pit, or a hollow.
- Ruggedness, mean absolute (Wilson)
- Topographic position index
- Roughness
- Position
Provenance
- Computed by
- raster.terrain.ruggedness 1.0.0, core 0.1.0
- Model
- TRI as the root of the summed squared differences from the center cell (Riley and others 1999, as the erratum printed with the paper corrects it) and also as the mean absolute difference (Wilson and others 2007, which GDAL offers as its Wilson algorithm); TPI as the center less the mean of its eight neighbours; roughness as the range across the window
- Accuracy
- Exact arithmetic on the elevations given.
- Notes
- 1 shown with the answer
- Cites
- Riley, S. J., DeGloria, S. D., and Elliot, R., Intermountain Journal of Sciences, A terrain ruggedness index that quantifies topographic heterogeneity; Wilson, M. F. J., O'Connell, B., Brown, C., Guinan, J. C., and Grehan, A. J., Marine Geodesy, Multiscale terrain analysis of multibeam bathymetry data for habitat mapping on the continental slope
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: TRI as the root of the summed squared differences from the center cell (Riley and others 1999, as the erratum printed with the paper corrects it) and also as the mean absolute difference (Wilson and others 2007, which GDAL offers as its Wilson algorithm); TPI as the center less the mean of its eight neighbours; roughness as the range across the window
Accuracy: Exact arithmetic on the elevations given.
When to use this: Use this to describe the shape of the ground around a cell rather than its steepness: ruggedness for how broken the terrain is, the position index for whether the cell sits above its surroundings (a ridge or summit) or below them (a valley or hollow), and roughness for the range within the window. They are the measures behind habitat, accessibility, and landform classification.
Limitations: Two different indices are called TRI, and on the same ground they differ by about a factor of three: Riley's own root of summed squares, and the mean absolute difference that many tools report under the name. Both are given, so a value can be matched to whichever one a paper or a dataset used. They all depend on the cell size and on the DEM's own smoothing: the same ground gives smaller numbers on a coarser grid, so values are comparable only within one resolution. The position index is a single scale — a cell can sit above its immediate neighbours and below the wider landscape — and none of these say anything about the direction the ground faces.
Worked example: A cell on a slope. Source: The definitions worked independently in Python (tools/vectors/gen_raster.py). It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.
You enter
- Cell size
- 30 m
- Elevation window
- 101.2, 100.6, 100.2 100.4, 99.8, 99.2 99.6, 99.0, 98.4
You get
- Terrain ruggedness index (Riley)
- 2.474 m
- Ruggedness, mean absolute (Wilson)
- 0.775 m
- Topographic position index
- -0.025 m
- Roughness
- 2.8 m
- Position
- below its neighbours: a valley, a pit, or a hollow
Review: Not yet independently reviewed by a GIS professional.
Last verified: 2026-09-22, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.
Status: version 1.0.0, core 0.1.0. See this tool in the verification report.
Checked against: 7 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- A terrain ruggedness index that quantifies topographic heterogeneity, Riley, S. J., DeGloria, S. D., and Elliot, R., Intermountain Journal of Sciences, Volume 5, issues 1-4, pages 23-27. TRI as the root of the summed squared differences from the center cell, per the erratum printed with the reprint, which corrects the code in the manuscript.
- Multiscale terrain analysis of multibeam bathymetry data for habitat mapping on the continental slope, Wilson, M. F. J., O'Connell, B., Brown, C., Guinan, J. C., and Grehan, A. J., Marine Geodesy, Volume 30, issues 1-2, pages 3-35. Topographic position index and roughness on a 3 x 3 window.
Experimental means this tool has not yet met the stable bar: at least 20 golden vectors, differential tests, and an independent worked example.