11.6 Viewshed Analysis
Which cells can see which? Line-of-sight from a DEM.
Key takeaways
- Viewshed computes visibility from one or more observer points across a DEM.
- Parameters include observer / target height, max distance, and earth-curvature correction.
- Used for telecommunications planning, scenic-impact assessment, defence, and tourism.
Introduction
A viewshed is the set of cells visible from a given observer point, given the terrain. Extended to many observers, it becomes cumulative visibility. Tools implement it as cell-by-cell line-of-sight from observer to target.
The basic algorithm
For each target cell:
- Draw a line from the observer (x₀, y₀, z₀ + observer_height) to the target (x, y, z + target_height).
- Sample elevations along the line at each intervening cell.
- Compute the line's elevation at each sample — linear between observer and target.
- If any intervening terrain is above the line, the target is hidden.
1gdal_viewshed -ox 500000 -oy 4000000 -oz 30 \
2 dem.tif viewshed.tifParameters:
-ox,-oy,-oz— observer x, y, height above ground.-md— maximum distance.-vv/-iv— values for visible / invisible cells.--curvature-correction— account for Earth's curvature.
Key parameters
Observer height
How high above the ground is the observer's eye? Standard 1.7 m for a person; 30 m for a telecom tower; 10 m for a fire lookout.
Target height
How tall is the target? Usually 0 (ground-level visibility). For telecom modelling, set to receiver antenna height.
Maximum distance
Beyond some range, visibility is irrelevant. For typical landscape studies, 5–20 km. For telecom microwave links, sometimes 100 km.
Earth curvature & refraction
At distances > 10 km, Earth's curvature hides targets below the horizon. Add a correction (k = 0.13 typically, accounting for atmospheric refraction).
Multi-observer viewsheds
For N observers, compute individual viewsheds and sum them:
1cumulative = np.zeros_like(dem, dtype='uint16')
2for obs in observers:
3 vs = compute_viewshed(dem, obs)
4 cumulative += vsEach cell value is the number of observers that can see it. Useful for:
- "Hidden" areas — cells visible to zero observers.
- Optimal sensor placement — where to add one more observer to maximise coverage.
- Scenic-impact assessment — from how many viewpoints is a new structure visible?
Horizon analysis
A related product: for each observer, the line along which terrain "cuts" the sky.
Use cases:
- Solar exposure modelling — does the sun rise above a ridge?
- Radio propagation limits.
- Scenic photography planning.
Offset points along a path
A road's viewshed along its length is not a single viewshed but a union of observer points at intervals (e.g., every 50 m along the road). This simulates what a moving viewer sees.
Performance
Viewshed is O(N × M) per observer — N cells, M observers. Optimisations:
- Restrict to a bounding box (
-mddistance). - Parallelise per observer.
- Use GPU-accelerated implementations for thousands of observers.
Limitations
- Vegetation — a DSM that includes canopy obscures visibility even when a real observer could see through gaps.
- Urban environments — buildings block lines of sight; use a DSM, not DTM.
- Weather — no real-world viewshed is always clear (fog, rain).
Use cases
- Telecom tower planning — which locations maximise coverage?
- Wind farm visual impact — from how many residences are turbines visible?
- Archaeology — Bronze Age fortresses often have high cumulative visibility.
- Fire lookouts — optimal tower placement.
- Defence — line-of-sight analysis for surveillance.
- Tourism — panoramic viewpoints from hiking trails.
Worked example
"Can a 5 MW wind turbine (hub 100 m) at (lat, lon) be seen from the town at (tx, ty)?"
1gdal_viewshed -ox X -oy Y -oz 100 -tz 1.7 -md 15000 \
2 --curvature-correction dem.tif view.tifThen check the value at the town's cell.
Self-check exercises
1. Why does viewshed look different when computed on a DTM vs a DSM?
A DTM (bare earth) treats trees and buildings as "not there" — so a target hidden behind a forest in the DTM viewshed appears visible. A DSM (surface including canopy and buildings) blocks lines of sight at treetop or roof level. For realistic scenic-impact studies in vegetated or urban areas, use a DSM. For open rural terrain, DTM is fine.
2. Why include earth curvature correction for long-distance viewsheds?
Earth's surface curves; at 10 km a target 4 m below the "flat earth" line is already at the horizon. Without correction, you overestimate visibility at long range. The typical correction factor k = 0.13 accounts for both curvature and atmospheric refraction bending light slightly along the surface.
3. How would you find the best location for a single new fire lookout given 10 existing ones?
Compute the cumulative viewshed of the 10 existing lookouts. The most hidden areas (low cumulative visibility) are candidate regions for the 11th tower. For each candidate cell, compute its viewshed and add to the cumulative — pick the cell that increases total coverage the most. This is a greedy maximum-coverage solution; more rigorous optimisation is possible but this works well.
Summary
- Viewshed = which cells are visible from an observer, given terrain.
- Key parameters: observer height, target height, max distance, curvature correction.
- Multi-observer cumulative viewsheds support optimisation and scenic-impact analysis.
- Use DSM for realistic visibility in vegetated or urban areas.
Further reading
- Fisher, P. F. — Reconsideration of the viewshed function in terrain modelling.
gdal_viewsheddocumentation.- GRASS
r.viewshedfor more advanced options. - Llobera, M. — Cognitive aspects of the viewshed analysis.
Module 11: Terrain & Hydrology
Answer these quick multiple-choice questions to check your understanding before moving on.