DEM slope by Horn's method
The slope at the center of a 3 x 3 elevation window, in degrees and percent, by Horn's method as gdaldem computes it.
The slope is 19.633°, or 35.67%.
- Slope, percent
Provenance
- Computed by
- raster.terrain.slope 1.0.0, core 0.1.0
- Model
- Horn's (1981) eight-neighbor gradients, slope = atan(z x hypot(dz/dx, dz/dy)), as in raster.terrain.slope-aspect
- Accuracy
- Exact evaluation of Horn's formulas. On a degree-based grid the cell sizes come from the WGS 84 meridian and prime-vertical radii at the latitude given.
- Notes
- None
- Cites
- Horn, B. K. P., Proceedings of the IEEE, Hill shading and the reflectance map
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: Horn's (1981) eight-neighbor gradients, slope = atan(z x hypot(dz/dx, dz/dy)), as in raster.terrain.slope-aspect
Accuracy: Exact evaluation of Horn's formulas. On a degree-based grid the cell sizes come from the WGS 84 meridian and prime-vertical radii at the latitude given.
When to use this: Use this when the slope is all you need from a DEM cell: for a grade limit, a site that has to stay under a slope for a building or a drone landing, or a check of one cell in a slope raster. Enter the nine elevations around the cell and the cell size. The answer is the slope in degrees and in percent.
Limitations: It works on the nine elevations you give, not on a raster. Horn's method smooths, so a slope from a coarse DEM is gentler than the ground, and a surface model includes buildings and canopy rather than the ground under them.
Worked example: A 10 m window on a hillside. Source: Horn's formulas in Python, checked against gdaldem 3.13.3 (tools/vectors/gen_terrain_views.py). It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.
You enter
- Cell size
- 10 m
- Elevation window
- 250.0, 252.5, 255.1 248.2, 251.0, 254.9 246.0, 249.3, 253.3
You get
- Slope
- 19.633°
- Slope, percent
- 35.67
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.
Changes
- 2026-10-14, changed: Slope, aspect, hillshade, the terrain ruggedness index, and the topographic position index, each as its own tool, are now stable. Each matches gdaldem 3.13.3 on 24 windows (hillshade exactly; the rest within gdaldem's 32-bit rounding) and its parent tool on 208 fixture windows, with invariant tests for turning, raising, and inverting the ground. Results are unchanged. Changelog
Checked against: 25 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Constants this tool assumes
Values you do not enter, and where each comes from.
- WGS 84 semi-major axis, for cell sizes given in degrees
6378137 m— Department of Defense World Geodetic System 1984- WGS 84 inverse flattening, for cell sizes given in degrees
298.257223563— Department of Defense World Geodetic System 1984
Sources
- Hill shading and the reflectance map, Horn, B. K. P., Proceedings of the IEEE, Volume 69, issue 1, pages 14-47. The eight-neighbor gradient estimate used for slope, aspect, and hill shading.
Terms
- DEM: digital elevation model
- A grid of elevations. A surface model includes buildings and canopy; a terrain model is the ground beneath them. Source: Copernicus DEM GLO-30