geoprimsField-grade geospatial math

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.

19.633°

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?

Your values

Showing an example. Change anything.
More options 1
Run many at once from a CSV

Loading…

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

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

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