Terrain & Elevation

Turn a grid of heights into slope, shade, contours and drainage.

The terrain path, from what a DEM actually is to flow direction and viewsheds. a grid of heights, and everything that falls out of it1DEM, DSM, DTMand which you have2slope & aspectfrom the neighbours3hillshade, contoursand their failures4flow & viewshedthe useful endThe first two are concepts: a wrong vertical datum or cell size makes every derivative wrong

A DEM is the one raster whose values people reason about directly, which is why terrain errors are so easy to miss: a slope map made from a geographic-CRS DEM is wrong everywhere and looks fine. These guides start with what kind of surface you actually have — ground or canopy, and measured from which zero — then derive slope and aspect, hillshade, contours, elevation profiles, flow direction and viewsheds, each with the failure that most often makes the output quietly meaningless.

If you already have a DEM and know its vertical datum and cell size, start at stage three. If you do not, the first two guides are worth twenty minutes, because a slope computed from the wrong surface or in the wrong units is wrong by orders of magnitude rather than by a little.

The full path, in order

The concepts underneath the work, then each task, then the errors that task produces. Work down, or jump to the step you need.

  1. Vertical Datums Explained: Why Your Elevations Are Off vertical datum explained 🧭 Concept
  2. Slope and Aspect Explained: How They Are Computed from a Grid slope aspect explained 🧭 Concept
  3. How to Calculate Slope and Aspect from a DEM in Python calculate slope python dem ⚙️ How-To
  4. Slope Values Are Wrong or Absurdly Steep slope values wrong 🔧 Fix
  5. How to Make a Hillshade from a DEM in Python hillshade python ⚙️ How-To
  6. Hillshade Looks Flat, Washed Out or Inverted hillshade inverted 🔧 Fix
  7. How to Generate Contour Lines from a DEM in Python generate contours python ⚙️ How-To
  8. Contours Come Out Jagged or Full of Tiny Rings contours jagged noisy 🔧 Fix
  9. How to Extract an Elevation Profile Along a Line in Python elevation profile python ⚙️ How-To
  10. How to Fill Sinks and Derive Flow Direction from a DEM fill sinks flow direction python ⚙️ How-To
  11. How to Calculate a Viewshed in Python viewshed python ⚙️ How-To

Topics this path covers

A path is a route; a topic is everything the site has on a subject. Open a topic to see the guides this path skips.

Other ways in