Some data layers change the way you see a landscape forever. For me, it was the first time I draped a hillshade over a plain contour map. The contours had told me, in their abstract way, that the land rose to the north. The shaded relief showed me a valley I could almost walk into, a ridge that explained why the old road took a strange detour, and a scar where a landslide had once come down. Same data, different understanding.
That is the power of the elevation-model/” data-khs-tag=”315″>digital elevation model, and of the terrain-analysis/” data-khs-tag=”477″>terrain analysis built on top of it. Elevation is the foundation of hydrology, engineering, hazard mapping, telecommunications, forestry, agriculture and half the questions we ask about land. In this guide I’ll explain what a DEM is, where to get one, how to prepare it, and how to derive the surfaces that turn raw heights into insight: slope, aspect, hillshade, flow, watersheds and viewsheds.

What Is a Digital Elevation Model?
A digital elevation model (DEM) is a representation of the height of the Earth’s surface, most commonly as a raster: a grid in which each cell holds an elevation value. The cell size sets the resolution, such as 30 meters, 10 meters or 1 meter. If the raster concept is new to you, read Vector vs. Raster Data: The Complete Guide.
DEM, DSM and DTM: the vocabulary
People use “DEM” loosely, but precise terms matter.
- DSM (Digital Surface Model): the height of the top of everything: treetops, roofs, bridges and ground.
- DTM (Digital Terrain Model): the height of the bare ground, with vegetation and buildings removed.
- DEM: the general term. Sometimes it means a DTM, sometimes a DSM, depending on the source. Always check which one you have.
Why it matters: for hydrology and slope on the ground, you want a DTM. For line-of-sight over a forest, or for estimating the height of buildings and trees, you want a DSM, or the difference between DSM and DTM, which gives the height of objects above ground.
Other forms of elevation data
- Contour lines: vector lines of equal elevation, the traditional form.
- Spot heights: points with measured elevations.
- TIN (triangulated irregular network): a surface made of connected triangles.
- Point clouds: raw LiDAR points, before gridding.
Where Do DEMs Come From?
How they are made
- Radar from space, for example the Shuttle Radar Topography Mission and the TanDEM-X mission.
- Optical stereo imagery, by matching overlapping satellite or aerial photos.
- LiDAR, from aircraft or drones, which measures distance with laser pulses and can see through gaps in vegetation, giving high-resolution terrain.
- Photogrammetry from drone images.
- Digitized contours, converted into surfaces through interpolation. See Interpolation Methods (IDW, Kriging, Spline) Explained.
- Surveys, for engineering sites.
Free global DEMs
- SRTM: near-global coverage at about 30 meters, a classic.
- ASTER GDEM: about 30 meters, noisier in places.
- Copernicus DEM (GLO-30): a high-quality 30-meter global model, often my first choice today.
- ALOS World 3D (AW3D30): about 30 meters, good in mountains.
- FABDEM: a derivative of Copernicus DEM with building and forest heights removed, useful for flood modeling.
- National LiDAR programs: many countries publish elevation data at 1 to 5 meters, or finer. Check your mapping agency. See Open Data Portals by Country and Where to Find Free GIS Data (Complete Source List).
Know Your DEM: Quality Checks
Before analyzing, interrogate the data.
- Resolution (cell size): matches the scale of your question? A 30-meter DEM can’t show a 5-meter gully.
- Vertical accuracy: how many meters of error are in the heights? A model with an error of several meters is useless for subtle slopes on flat land.
- DSM or DTM? As discussed.
- Vertical datum: elevations may refer to the geoid (approximately mean sea level) or the ellipsoid. The difference can be tens of meters. Mixing two DEMs, or a DEM and GPS heights, with different vertical references produces systematic errors. Check the metadata, as explained in Metadata in GIS: Why It Matters and How to Create It.
- Horizontal CRS: many global DEMs are in latitude and longitude, which complicates slope calculation. See below.
- Voids and artifacts: gaps, spikes, striping, or water bodies with odd values. Some DEMs have filled voids with other data.
- Date: the terrain may have changed due to construction, mining or erosion.
- Units: meters or feet?
Preparing the DEM
- Clip to your study area, with a buffer to avoid edge effects in analysis.
- Reproject to a suitable projected CRS in meters. This is crucial for slope. If the DEM stays in degrees, horizontal and vertical units differ, and slope comes out wrong unless you apply a conversion factor. When you reproject a DEM, use bilinear or cubic resampling, not nearest neighbor, to avoid stepped artifacts. For choosing the system, see Map Projections: How to Choose the Right One.
- Fill voids and remove spikes if needed.
- Smooth lightly if the DEM is noisy, remembering that smoothing changes slope.
- Fill sinks (depressions) before hydrological analysis, because most flow algorithms need terrain that drains continuously.
- Keep the original, and document the processing.
Core Terrain Derivatives
From a single DEM you can derive many useful surfaces. These are the essentials.
Slope
Slope is the steepness of the terrain at each cell, the rate of change of elevation. It can be expressed in degrees (0 is flat, 90 is vertical) or percent (rise over run times 100, where 100 percent is 45 degrees).
Slope drives erosion, landslide susceptibility, construction feasibility, agricultural suitability, route planning and solar exposure. It is typically calculated from the eight neighbors of each cell, using a method such as Horn’s.
Aspect
Aspect is the compass direction that the slope faces, from 0 to 360 degrees. North-facing and south-facing slopes differ in sunlight, moisture, snow, vegetation and microclimate. Flat cells have no aspect.
Hillshade
Hillshade simulates how the terrain would look lit from a given direction and height, creating a shaded relief. It is a visualization, not an analysis result, but it makes terrain readable at a glance. A common default is a light source from the northwest (azimuth 315 degrees) at 45 degrees elevation, which suits our habit of reading light from the top left. Combine it with a semi-transparent color ramp of elevation for a classic, beautiful relief map. The design logic is covered in Cartography Principles: Designing Maps That Communicate.
Curvature
Curvature describes how the slope itself changes:
- Profile curvature (in the direction of the slope) indicates acceleration or deceleration of flow.
- Plan curvature (across the slope) indicates convergence or divergence of flow.
Used in landform classification, erosion modeling and soil mapping.
Roughness and ruggedness
- Terrain Ruggedness Index (TRI) and roughness measure how variable the elevation is in a neighborhood.
- Topographic Position Index (TPI) compares a cell with its surroundings, helping to identify ridges, valleys and flat areas.
Contours
Contour lines can be generated from a DEM at a chosen interval. They are easy to read for people accustomed to topographic maps, and are used in engineering and design.
Profiles and cross-sections
A profile shows elevation along a line, useful for roads, pipelines and visibility checks.
Hydrological Analysis
DEMs let you model how water moves across the land. The standard workflow:
- Fill sinks: remove artificial depressions so water can flow out.
- Flow direction: for each cell, the direction of steepest descent to a neighbor. The commonly used D8 method sends flow to one of the eight neighbors, while other methods distribute it among several.
- Flow accumulation: for each cell, the number of upstream cells that drain into it, which means the contributing area. High values trace the drainage network.
- Stream extraction: choose a threshold of accumulation above which cells are considered streams.
- Stream ordering: classify streams by hierarchy.
- Watershed (catchment) delineation: for chosen outlet points, find the entire area that drains to them.
These steps support flood studies, water resource planning, erosion and pollution modeling. The limits of automatic extraction are important: DEM errors, flat areas, culverts under roads and artificial drainage can make the modeled streams differ from reality. Always compare with imagery and known streams.
Visibility Analysis
- Line of sight: is one point visible from another, given the terrain between them?
- Viewshed: the whole area visible from one or more observer points, taking observer height and a target height into account.
Used in telecommunications (siting towers), landscape impact assessment, security and heritage visibility. Use a DSM if buildings and trees matter, and remember that atmospheric effects and Earth’s curvature matter over long distances.
Other Useful Analyses
- Solar radiation: how much sunlight each cell receives, considering slope, aspect and shading. Essential for solar energy siting and agriculture.
- Cut and fill (volume): the volume of earth to remove or add when changing a surface, with the difference between two DEMs giving the change.
- Change detection: subtract an older DEM from a newer one to see erosion, deposition, landslides, mining or construction.
- Least-cost paths: use slope as a cost surface to find the easiest route across terrain, as an extension of Network Analysis and Route Optimization.
- Landform classification: combine slope, curvature and position indices to map ridges, valleys, plains and so on.
- Suitability modeling: reclassify slope, aspect and elevation and combine them with other criteria. See Spatial Analysis in GIS: Complete Guide.
Doing It in Practice
In QGIS
The Processing Toolbox includes raster terrain analysis tools for slope, aspect, hillshade, ruggedness and roughness, plus many more through GDAL, GRASS and SAGA. The Value Tool and Profile Tool plugins help to inspect results. See Best GIS Plugins for QGIS.
In ArcGIS Pro
The Spatial Analyst and 3D Analyst extensions provide slope, aspect, hillshade, curvature, hydrology tools, viewshed and more.
With GDAL
The gdaldem command is fast and reliable for the classics:
# Slope in degrees (DEM must be in a projected CRS in meters)
gdaldem slope dem_utm.tif slope.tif -compute_edges
# Aspect
gdaldem aspect dem_utm.tif aspect.tif -compute_edges
# Hillshade (azimuth 315, altitude 45 by default)
gdaldem hillshade dem_utm.tif hillshade.tif -compute_edges
# Terrain Ruggedness Index
gdaldem TRI dem_utm.tif tri.tif -compute_edgesIf your DEM is in geographic coordinates, reproject it first, or supply a scale factor to relate horizontal degrees to vertical meters. See Best Free and Open-Source GIS Tools for more on GDAL.
In Python and R
Libraries such as Rasterio, Xarray, RichDEM, WhiteboxTools and terra provide terrain and hydrology functions that can be scripted for repeated work. See Geospatial Development & Automation: The Ultimate Guide.
A Worked Example: Finding Sites for a Small Solar Farm
Question: which areas in the region are physically suitable?
- Get a DEM of suitable resolution, check it is a DTM, and reproject to a projected CRS.
- Calculate slope, and keep areas below, say, 10 degrees (the threshold depends on the technology and local standards).
- Calculate aspect, and prefer slopes facing the equator, where relevant.
- Calculate solar radiation, or approximate it with aspect and shading.
- Remove unsuitable land with overlay tools: protected areas, water, forests, flood zones. See Buffer, Clip, Intersect, Union: Overlay Tools Explained.
- Add distance to roads and power lines, using buffers or network analysis.
- Combine the criteria with weights, in a suitability model, and rank the candidate areas.
- Verify the top sites visually on imagery, and in the field.
The DEM supplies three of the criteria directly. Without it, you would be guessing.
Common Mistakes
- Using a DSM when you need a DTM, and mistaking treetops for ground.
- Calculating slope in degrees of latitude and longitude, with no conversion. The slope values will be completely wrong.
- Ignoring vertical datum differences between data sources.
- Reprojecting with nearest neighbor, which creates artificial terraces.
- Not filling sinks before hydrological analysis, which breaks flow paths.
- Trusting a coarse DEM for fine problems. A 30-meter DEM can’t tell you about a 3-meter embankment.
- Taking automatic stream networks as truth. Check them against reality.
- Overlooking artifacts, such as striping, spikes and water bodies with spurious heights.
- Ignoring edge effects, by clipping the DEM too tightly before analysis.
- Over-interpreting hillshade. It is a visualization that depends on light direction, and can hide or create illusions.
- Forgetting that terrain changes, through mining, construction and erosion.
Final Thoughts
A DEM is a deceptively simple dataset, a grid of numbers, that quietly underlies a large part of spatial analysis. From it we derive slope, aspect, flow, visibility and much more, and each derivative answers a different practical question. But the quality of every result is bounded by the quality of the elevation model, so the first step is always to know what you have: resolution, accuracy, type and datum.
Choose a DEM of your own area, calculate slope and hillshade, and compare them with a satellite image. You will start to see terrain the way experienced analysts do, as the hidden structure beneath every map.
Where to go next: study Spatial Autocorrelation and Moran’s I Explained to understand the statistical backbone of spatial patterns, and revisit Remote Sensing Basics for GIS Users to see how elevation data is gathered from space.



