geoprimsField-grade geospatial math

DEM aspect, the way the ground faces

The aspect at the center of a 3 x 3 elevation window: the downslope direction clockwise from north, by Horn's method as gdaldem computes it.

north-east

The ground falls toward the north-east.

Aspect
Provenance
Computed by
raster.terrain.aspect 1.0.0, core 0.1.0
Model
Horn's (1981) eight-neighbor gradients, aspect = 90 - atan2(dz/dy, -dz/dx) in degrees, clockwise from north and downslope, as in raster.terrain.slope-aspect; none where both gradients are zero
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.
Run many at once from a CSV

Loading…

How we got thisFormula, worked example, sources, and proof

Model: Horn's (1981) eight-neighbor gradients, aspect = 90 - atan2(dz/dy, -dz/dx) in degrees, clockwise from north and downslope, as in raster.terrain.slope-aspect; none where both gradients are zero

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 to find which way a piece of ground faces: for sun on a solar site or a garden, snow and ice that lingers on north-facing slopes, or a check of one cell in an aspect raster. Enter the nine elevations around the cell and the cell size. The answer is the compass direction the ground falls toward.

Limitations: It works on the nine elevations you give, not on a raster. On nearly flat ground the aspect swings with small errors in the elevations, so treat it as unreliable under about half a degree of slope; a window with no slope at all has no aspect and is reported as flat.

Worked example: A 10 m window falling to the north-east. Source: Horn's formulas in Python, checked against gdaldem 3.13.3 (tools/vectors/gen_terrain_views.py).

You enter

Cell size
10 m
Elevation window
500, 498, 495 503, 500, 497 507, 504, 500

You get

Facing
north-east
Aspect
45°

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