Terrain & elevation

Working with DEMs: slope, aspect, hillshade, contours, profiles and drainage.

Slope computed from a three-by-three neighbourhood, and how the answer moves with the cell size. slope is computed from the neighbours, so the cell size is part of the answer3 × 3the only input1 m DEM → 21.4°10 m DEM → 14.2°30 m DEM → 8.1°the same hillside,three defensibleanswersA coarser DEM does not smooth the slope a little — it computes a different quantity

Everything in this topic is derived from one array of elevations, and every derivative — slope, aspect, hillshade, curvature, flow direction — is computed from a cell and its immediate neighbours. That is why the cell size is not a detail: the same hillside measured on a 1 m DEM and a 30 m DEM gives genuinely different slopes, and neither is wrong.

The other recurring issue is units. A DEM in metres on a grid in degrees produces slopes that are absurd by a factor of about 10⁵, and the calculation completes without complaint. Vertical datums add a second axis of the same problem: elevations above an ellipsoid and above a geoid differ by tens of metres.

The pages below cover what each derivative means, how to compute it correctly, and the specific ways a terrain analysis comes out wrong — most often because a CRS, a unit or a resolution was not what the function assumed.

Learning paths run through this topic too — see the end of this page.

🧭 Start with the concepts

The ideas the how-to guides below assume you already have.

Show every concept in this topic

⚙️ Then do the task

Step-by-step walkthroughs with code you can copy and adapt.

Show every how-to guide in this topic

🔧 When it breaks

The errors this topic produces, with the cause explained rather than just the command.

Show every fix in this topic

Related topics

Subjects that keep coming up alongside this one, most overlap first.

Keep browsing

Terrain & elevation sits in Analysis. Every topic on the site is listed on the topics index.