Terrain Analysis

What you compute from a DEM

CE 414 Engineering Applications of GIS
Civil & Construction Engineering
Brigham Young University

Dr. Dan Ames

CE 414 · Week 5 — Terrain AnalysisLast Updated: 2026-10-05© 2026 Daniel P. Ames · CC BY 4.0

Today's Goals

By the end of class you should be able to:

  • Explain what slope, aspect, curvature and hillshade measure, and how local terrain surfaces are computed from a 3 × 3 window
  • Compute slope at a cell by hand, two different ways, and get the answer the software would
  • Explain why cell size, vertical units and the slope algorithm are part of the reported value
  • Explain what a viewshed is
CE 414 · Week 5 — Terrain Analysis

Describe the terrain

Variable Description Importance
Height Elevation above base Temperature, vegetation, visibility
Slope Rise relative to horizontal distance Water flow, flooding, erosion, travel cost
Aspect Downhill direction of steepest slope Temperature, vegetation, soil moisture
Upslope area Watershed area above a point Soil moisture, runoff volume and timing, erosion
Flow length Mean upstream flow path length to a point Sediment and erosion rates
Profile curvature Curvature parallel to slope direction Erosion, water flow acceleration
Plan curvature Curvature perpendicular to slope direction Water flow convergence, soil water, erosion
Visibility Site obstruction from given viewpoints Utility location, viewshed preservation
CE 414 · Week 5 — Terrain Analysis

Scale is part of the answer

30 m cells

center

100 m cells

center

  • Coarser cells smooth over smaller ridges, channels and breaks in slope
  • The same hillside can produce different slope, aspect and curvature rasters at different cell sizes
  • Report the DEM cell size with the terrain result; it is part of what the number means
CE 414 · Week 5 — Terrain Analysis

Shaded relief

  • Shaded relief is a visualization (symbology) effect: shadowing is applied to highlight the terrain
  • Illumination direction is a modeling choice, not a property of the terrain
  • Why?
hillshadefacing the sun → brightfacing away or blocked → dark
CE 414 · Week 5 — Terrain Analysis

Contours

Slice the surface at fixed elevations
Shaded relief
shape, but no numbers
Color ramp
high vs. low, roughly
Contours
A sits on the 700 m line
  • A contour is a line of equal elevation; it runs at right angles to the local slope
  • Contours give clean numerical elevations at fixed locations: what grading, drainage and earthwork calculations need
CE 414 · Week 5 — Terrain Analysis

What does the terrain look like at A, B, C and D?

  • A?
  • B?
  • C?
  • D?
  • The photo is the same terrain, from the camera position marked on the map
CE 414 · Week 5 — Terrain Analysis

What are the steps to convert the DEM to the contour lines?

1Choose the intervalmin 412max 472420 m440 m460 mRead the DEM's range,pick a round intervalinterval = 20 m→ 420, 440, 460 m2Find where 440 falls430445458472422436452466415428446457412420433447440 lies between436 and 445, so thecrossing sits 4/9 of theway from 436 to 445linear interpolation3Connect the crossings430445458472422436452466415428446457412420433447420 m440 m460 mJoin them, then smooth4Lines never cross440460✓✗One spot cannot be 440 m and 460 m
CE 414 · Week 5 — Terrain Analysis

How would you do it?

  • What is the slope at the center cell?
  • The cell size is 10 m; the nine elevations are on the figure
  • Work in pairs. Write down the method you used, not just the number
CE 414 · Week 5 — Terrain Analysis

Slope

  • Slope is the change in elevation (rise) with a change in horizontal position (run)
  • Often reported in degrees between zero (flat) and 90 (vertical). At rise/run = 1, the slope is 45 degrees
  • Can also be expressed as a percent = (rise/run) × 100
CE 414 · Week 5 — Terrain Analysis

Slope in three dimensions

  • The local neighborhood supplies the elevations used to estimate the gradient
  • On a real surface, the steepest direction at a point is rarely aligned with a row or a column
CE 414 · Week 5 — Terrain Analysis

Slope on a grid

  • When computing slope on a grid, we have a problem: the slope direction is seldom exactly between the centers of two cells
  • So we need methods that look at several surrounding cells
CE 414 · Week 5 — Terrain Analysis

How would you do it?

  • What is the slope at the center cell?
  • The cell size is 10 m; the nine elevations are on the figure
  • Work in pairs. Write down the method you used, not just the number
CE 414 · Week 5 — Terrain Analysis

Slope: four nearest cells

center

Checking against GIS Fundamentals? Some earlier printings of this figure show dZ/dy = (Z2 − Z1)/2C and 25.3°; it should be (Z2 − Z7)/2C, and the arithmetic gives 25.38°.

CE 414 · Week 5 — Terrain Analysis

Slope: 3rd-order finite difference — try it

center

CE 414 · Week 5 — Terrain Analysis

Aspect

  • Aspect is the downhill direction of the steepest slope, reported as an azimuth clockwise from north

  • Same partial derivatives as slope; a different thing done with them
CE 414 · Week 5 — Terrain Analysis

Plan and profile curvature

  • Profile curvature — curvature parallel to the slope direction
  • Plan curvature — curvature perpendicular to the slope direction
  • Because curvature is a second derivative, it is especially sensitive to cell size and DEM noise
  • Can you calculate curvature?
  • Name some applications or uses for curvature
CE 414 · Week 5 — Terrain Analysis

A viewshed is a rotating searchlight

  • In other words: what could you see in all directions from the given point?
  • Sweep a beam from the viewer, mark every cell the beam reaches, and skip everything in shadow
  • The output is a raster: seen or not seen, cell by cell
CE 414 · Week 5 — Terrain Analysis

How to use a viewshed

Siting cell towers, search and rescue, scenic protection, security, wind turbines…

Example: a hike along the east bench of Utah County. Which stops see the most temples?

  • Visibility is symmetric: if the stop can see the temple, the temple can see the stop
  • So run one viewshed from each temple (raised to spire height) and add the seven rasters
  • Every cell now holds a count of temples visible; read it at each stop
  • The best stop is the one with the highest count
Utah LakeLake MountainsWASATCH RANGE▲ Mt. Timpanogos▲ Y Mountainbench trail✗✗Saratoga SpringsMount TimpanogosOremLindonProvo City CenterProvo Rock CanyonPayson12345visible from stop 3blocked by a ridgetrail stopDiagram, not to scaleN
CE 414 · Week 5 — Terrain Analysis

Final Thoughts

Quiz: Slope, Aspect, Viewshed. Six questions on what you get out of a DEM — contours, hillshade, aspect, slope, and what a viewshed can and cannot tell you. Scan the code, or open the link under it.

  • Not graded, nothing recorded: a quick check that today's material made sense
  • The last two are about viewsheds: what one cell value means, and how to count what a whole hike can see

Before next class

  • Reading: Chapter 11 of GIS Fundamentals (Terrain Analysis)
  • Quiz 5, open book, on Learning Suite — due Saturday 11:59 pm
  • Lab 4 — Cell Phone Tower Placement is due Saturday 11:59 pm — see the Lab 4 page
  • Lab 5 — Watershed Delineation is next — see the Lab 5 page
  • Questions? Office hours: calendly.com/dan-ames/office-hours

center

byu-hydroinformatics.github.io/ce414-gis-applications/quizzes/terrain-analysis/

CE 414 · Week 5 — Terrain Analysis

Week 5 concepts lecture. Everything in this deck is a raster surface operation: the input is a DEM and the output is another raster that answers an engineering question. The lab this week applies it.

stamp:begin

stamp:end

Tuesday was where the surface comes from; today is what you derive from it. Most of today's terrain surfaces are raster in, raster out, computed from a moving window — the focal pattern from Week 3. A viewshed is the exception: it is a line-of-sight calculation from an observer through the surface. Say that distinction out loud once. The image is a hillshaded, color-tinted 3D render of a real 3 arc-second DEM of the Jacksboro Fault area, Tennessee (the sample DEM that ships with matplotlib), made for this deck.

The "Importance" column is the reason any of this is in a civil engineering course. Each row is one raster tool: the input is the DEM, the output is another raster in the units named.

TODO(instructor): this table is the natural place to separate susceptibility, hazard, risk and exposure — slope and curvature feed a susceptibility surface, not a risk map. Decide whether to define the four terms here or in a later week.

These two images show the same terrain at two cell sizes. The point is not that one is universally right: the useful scale depends on the engineering question, the source data and the processing time you can afford. Lab 4 deliberately uses 30 m cells for a county-wide screening model.

Ask it as a real question before answering. A hillshade is not a measurement; it is a rendering of one, computed by illuminating the surface from an assumed sun azimuth and altitude. It reads as three-dimensional because the eye is good at shape from shading. In ArcGIS Pro this is the Hillshade tool in Spatial Analyst. The animation: the sun sits at the northwest corner of the map because 315 degrees azimuth is the conventional default; on the profile, faces turned toward the sun are bright, faces turned away are dark, and one rising face is dark because the peak in front of it casts a shadow. The profile draws rays fanning from a nearby sun for legibility; the real calculation assumes parallel rays from one azimuth and altitude.

VERIFY: ArcGIS Pro tool names named in the speaker notes of this deck (Hillshade, Slope, Aspect, Curvature, Contour, Viewshed) against the Pro version the course is taught on.

TODO(instructor): connect the hillshade to scale and uncertainty — the illumination azimuth is a choice, and it decides which landforms appear and which vanish. Decide how much of that to say here.

Contours give you readable numbers off a paper or PDF map, which a color ramp cannot. They also carry slope information in their spacing. Ask the class where they have actually used contours: grading plans, site drainage, trail maps. Ask what elevation point A has on each of the three maps: only the contour map answers with a number. The three maps are the same 90 m x 90 cell window of the matplotlib sample DEM (Jacksboro Fault, Tennessee, 3 arc-second cells, lightly smoothed), drawn for this deck; contours every 50 m with 100 m index lines.

Let them argue before you show the photo connection. Close contours mean steep, wide spacing means flat; contours that point upstream mark a valley, contours that bulge downhill mark a ridge. Match each letter to a feature in the photograph.

Answer sketch: pick a contour interval, then for every pair of adjacent cells find where the chosen elevation falls between them and interpolate the crossing point; connect crossings into lines; smooth. The tool is Contour in Spatial Analyst. Ask what happens to the output if the interval is too small for the cell size. The four panels play in order when the slide opens; let the room guess each step before it appears. The 4 x 4 grid values are illustrative.

First pass: announce the activity and let them look at the nine numbers, then move on through the three slope slides before they work it. Take two or three methods from the room before showing the next slides. Common answers: steepest neighbor, average of the four cardinal neighbors, fit a plane through all nine. All three are real algorithms.

Both units are in use and they are not interchangeable: 100 percent is 45 degrees, not 90. The worked example on the figure converts 3 percent to 1.72 degrees. Make the class do one conversion out loud.

The arrows on the figure are the direction of steepest descent at each location. Slope has a magnitude and a direction; the magnitude is the slope raster, the direction is the aspect raster.

This is why there is more than one slope algorithm. Each one is a different weighting of the eight neighbors, and they give different answers on the same DEM.

TODO(instructor): tie slope to scale and uncertainty here — slope computed on a 10 m grid and slope computed on a 30 m grid over the same hillside are different numbers, and neither is wrong. Decide how to frame the dependence on cell size and on DEM vertical error.

Second pass: pause here and let pairs actually work it, now that they have seen rise over run and why the steepest direction falls between cells. Take two or three methods from the room before showing the next slides. Common answers: steepest neighbor, average of the four cardinal neighbors, fit a plane through all nine. All three are real algorithms.

Only the four cardinal neighbors are used; the diagonals get weight zero. Two central differences give dZ/dx and dZ/dy, and the slope is the arctangent of the magnitude of that gradient: 25.4 degrees here (25.38). The book figure this slide replaces had Z1 for Z7 in the dZ/dy formula and printed 25.3; the typo is believed fixed from the 6th edition onward — verify against the edition students own.

This is the method ArcGIS Pro's Slope tool uses. All eight neighbors contribute, with the cardinal ones weighted double. Same nine elevations as the previous slide, and the answer comes out 22.8 degrees instead of 25.4 — a 2.6 degree spread from the choice of algorithm alone. The worked numbers appear on one click: let pairs try it first. Have them reproduce both numbers before moving on. Students who round dZ/dx and dZ/dy to 0.39 and −0.16 before the arctangent get 22.9; that is rounding, not a different answer. Figure: tools/week05_slope_third_order_svg.py, which replaced a scanned figure whose dZ/dy formula was mislabeled "dZ/dx" and whose worked dZ/dy listed the three differences in the reverse order of its formula.

TODO(instructor): the plan calls for a validation exercise here — students compute slope by hand and compare against the Slope tool's output for the same cell. Decide whether it belongs in this lecture, in the lab, or on the quiz, and what counts as agreement.

TODO(instructor): aspect has its own scale-and-uncertainty story — on gentle slopes the direction of steepest descent is almost arbitrary, so aspect is noisiest exactly where slope is smallest, and it changes with cell size. Decide whether to make that point here or alongside the slope slide.

Aspect is circular data: 359 degrees and 1 degree are two degrees apart, not 358. That breaks averaging, and it is why aspect is usually reclassified into compass sectors before it is used. Flat cells have no aspect at all and are coded separately.

Curvature is the second derivative of the surface, fitted from the same 3 x 3 window. Profile curvature controls whether flow accelerates or decelerates downslope; plan curvature controls whether it converges into a hollow or spreads over a nose. Together they predict where water and sediment collect.

TODO(instructor): curvature is the most scale-sensitive of these surfaces — the second derivative amplifies DEM noise, so a 1 m lidar DEM and a 30 m DEM give qualitatively different curvature maps. Decide how to make that point, and whether to require smoothing before curvature in the lab.

The profile at the top of the figure is the whole algorithm in one dimension: from the viewer, a line of sight rises at some angle, and any cell below the running maximum angle is hidden. The 3D block is the same test run outward in every direction.

TODO(instructor): viewshed results depend on choices the tool makes you name — observer and target offsets, earth curvature and refraction correction, the analysis radius, and the DEM's cell size. Decide how to present that as an uncertainty story rather than a parameter list.

The diagram is not to scale and the sight lines from stop 3 are illustrative, not the output of a real viewshed run; the point is the workflow. Temples shown are the seven dedicated temples in Utah County (Saratoga Springs, Mount Timpanogos, Lindon, Orem, Provo City Center, Provo Rock Canyon, Payson) at approximate positions — VERIFY the list is current before each offering. The two ridge spurs stand in for foothills that block a line of sight along the bench. In ArcGIS Pro, the Viewshed tool takes an observer offset for the spire height; adding the seven outputs with Raster Calculator gives the count. The Visibility tool can also report how many observers see each cell (VERIFY the analysis-type option name). Ask what else would change the answer: trees, buildings, observer eye height, and the DEM's cell size.

Five minutes, in pairs, then a show of hands on the two that split the room. The aspect item catches people who read aspect as uphill, or as a compass bearing counterclockwise. The 25.4 versus 22.8 item is the other one; the point is that both answers are right and the method is part of the result. The temple item checks that they saw why visibility is symmetric. If the room has no signal, put the URL on the board; the items read aloud just as well.

Conversion notes (2026-09-03): CROP (2026-09-03): the five browser captures (National Map, SRTM/GISGeography, Earthdata, JAXA ALOS, Mars DEMs) had the Chrome tab strip and address bar removed because they showed the capturing user's other open tabs and profile avatar; page content unchanged. source "CE 414 Week 5 - Terrain Analysis.pptx", 28 slides, no hidden slides and no speaker notes in the source — every note in this deck is new. 28 source slides became 35: added a title byline slide, Today's Goals, three section dividers, a Lab 4 preview, and Before Next Class; source slide 22 was split into two slides (four nearest cells / 3rd-order finite difference) because its figure is unreadable at 16:9 on one slide. No slides were dropped. The duplicated sentence on the ASTER slide was removed. Source media1 (a stock tomato photo, unused by any slide) was not carried over. Slides 2, 3, 11 and 26 were built from PowerPoint shapes and are 200 dpi renders of the PDF page, cropped. Stale non-ArcGIS screenshots kept and flagged: The National Map, the SRTM page (a third-party page with an advertisement in the capture), Earthdata Search, and the JAXA portal. There are no ArcMap-era ArcGIS captures in this deck and no ArcGIS UI at all — ArcGIS Pro tool names appear only in speaker notes and carry a VERIFY. Open items: DEM resolution and dataset claims (four VERIFY flags plus a 3DEP terminology TODO; ten VERIFY flags in the deck overall), native-vs-resampled resolution, scale/uncertainty for hillshade, slope, curvature and viewshed, a hand-versus-tool validation exercise, the susceptibility/hazard/risk/exposure distinction, the reading chapter, the Week 5/6 lab schedule, and three TODO(graphic) slides.

Split notes (2026-09-10). This deck used to open with Part 1, "Elevation surfaces and where DEMs come from" — eleven slides that have moved to slides/week-05/elevation-data-lidar.md, the new Tuesday deck, along with the LiDAR block from Week 4. What remains is what you compute from a DEM, which is a Thursday session of 23 slides. The two remaining parts were renumbered 1 and 2 (they were 2 and 3). Today's Goals was rewritten to promise only what this deck now delivers, and it names the handoff: cell size was chosen on Tuesday and every moving-window surface here depends on it. The deck's day in tools/build_schedule.py changed from None to Thu.

Revision notes (2026-09-30): aligned the Lab 4 preview with the assigned model, which uses Slope, road proximity and tower density rather than Viewshed; corrected the self-check framing so the viewshed question is not presented as a Lab 4 deliverable; added a scale/cell-size slide; and made the distinction between moving-window terrain surfaces and line-of-sight viewsheds explicit.

TODO(graphic): no graphic on this slide; a small course-schedule or lab-thumbnail figure would carry it.