Planetary-scale answers, unlocked.
A Hands-On Guide for Working with Large-Scale Spatial Data. Learn more.
Authors
A digital elevation model (DEM) is a raster in which every cell holds a height, on a regular grid with a known cell size, horizontal coordinate system, and vertical datum. The term covers two kinds of model. A digital terrain model (DTM) records the bare ground. A digital surface model (DSM) records the first surface seen from above, including trees and roofs. Slope, aspect, hillshade, drainage, and visibility are all computed from a DEM. Flood maps, site screening, and line-of-sight planning start from one. The claim this article tests: a free 30 m surface model is enough for regional slope classes, and too coarse for slope at building scale.
The Havasu catalog holds two global elevation rasters. One is Copernicus DEM GLO-30, a 30 m surface model. The other is the Advanced Spaceborne Thermal Emission and Reflection Radiometer (ASTER) Global DEM v3, at the same grid spacing.
Charles Miller and Robert Laflamme of the Massachusetts Institute of Technology Photogrammetry Laboratory introduced the digital terrain model in 1958. Their model was many points with known x, y, and z coordinates that represent the ground. The modern DEM is the gridded form of that idea, stored as a raster such as a GeoTIFF.
The USGS defines a DEM as the bare-earth surface excluding trees, buildings, and other surface objects. The Copernicus DEM product handbook states that the Copernicus DEM is a DSM that includes buildings, infrastructure, and vegetation. A DSM minus a DTM gives the height of trees and buildings, the basis of canopy and building height models in lidar data.
A DEM is built by measuring heights, putting them on a grid, and tying them to a datum.
Measure. Radar interferometry compares the phase of two radar images taken from slightly different positions. Lidar times laser pulses. Stereo photogrammetry matches features in two optical images. Ground survey and digitized contours fill the rest. Radar and stereo imagery record the first surface they reach, so they produce surface models. Lidar records several returns per pulse, so one survey yields both a DSM and a DTM.
Grid. Interpolation turns points or image matches into a regular grid. Cell size, often called resolution, is the grid spacing: 1 arc-second, about 30 m, for the global products, and 1 m for lidar-derived national models. Michael Hutchinson's ANUDEM method made gridded surfaces drain the way real valleys do. He described it in A new procedure for gridding elevation and stream line data with automatic removal of spurious pits (Journal of Hydrology, 1989).
Reference. Every height is relative to a vertical datum, covered below.
A 30 m cell averages everything inside it, so a levee or a narrow ridge crest can disappear while the cell stays within its accuracy specification.
SRTM. The Shuttle Radar Topography Mission flew on Space Shuttle Endeavour in February 2000 with one radar antenna in the payload bay and a second on a 60 m mast. Farr and colleagues describe it in The Shuttle Radar Topography Mission (Reviews of Geophysics, 2007). Rodríguez, Morris, and Belz checked it against ground truth worldwide in A global assessment of the SRTM performance (2006). Outside the United States it was distributed at 3 arc-seconds until the 1 arc-second global release began in September 2014. NASA's NASADEM is SRTM reprocessed with vertical control from the Ice, Cloud, and land Elevation Satellite (ICESat).
ASTER GDEM. Japan's Ministry of Economy, Trade and Industry and NASA built the ASTER Global Digital Elevation Model (GDEM) by stereo correlation of ASTER scenes. Tachikawa and colleagues described version 2 (IGARSS 2011), and Abrams, Crippen, and Fujisada documented version 3, released in August 2019 from 1.8 million scenes.
ALOS AW3D30. The Japan Aerospace Exploration Agency (JAXA) built ALOS World 3D 30 m from the archive of the PRISM stereo camera. PRISM, the Panchromatic Remote-sensing Instrument for Stereo Mapping, flew on the Advanced Land Observing Satellite (ALOS), which operated from 2006 to 2011. Tadono and colleagues report the method in Precise global DEM generation by ALOS PRISM (2014).
Copernicus GLO-30. The TerraSAR-X and TanDEM-X satellites flew in close formation and imaged each spot from two positions at once. Krieger and colleagues describe this synthetic aperture radar (SAR) formation in TanDEM-X: a satellite formation for high-resolution SAR interferometry (2007). Rizzoli and colleagues assessed the global TanDEM-X DEM (2017). The Copernicus DEM comes from the 2011 to 2015 acquisitions. Its handbook specifies an absolute vertical accuracy better than 4 m at 90 percent linear error: 90 percent of heights fall within 4 m of the truth. The data are on AWS Open Data as Cloud Optimized GeoTIFFs.
FABDEM. Hawker and colleagues used machine learning trained on airborne lidar to remove tree and building heights from Copernicus GLO-30. They describe the method in A 30 m global map of elevation with forests and buildings removed (Environmental Research Letters, 2022). Mean absolute vertical error fell from 1.61 to 1.12 m in built-up areas and from 5.15 to 2.88 m in forests.
USGS 3DEP. The 3D Elevation Program builds national bare-earth DEMs from airborne lidar. It serves them as 1 m project tiles and as seamless 1/3, 1, and 2 arc-second layers. A seamless layer has no gaps or edges between survey projects. The USGS reports an absolute vertical accuracy of about 0.82 m RMSE (root mean square error) for the seamless 1/3 arc-second layer. That figure covers the conterminous United States as of 2022.
Satellites measure heights above an ellipsoid, a smooth mathematical shape of the Earth. Most DEMs convert them to heights above a geoid, the surface of equal gravity potential that approximates mean sea level. The geoid rises above the ellipsoid in some regions and dips below it in others, so the two heights for one spot differ.
Slope and aspect. Slope is the steepest rate of height change at a cell, and aspect is the compass direction it faces. Both come from the east-west and north-south height gradients over the 3 by 3 window. Berthold Horn's method, from Hill shading and the reflectance map (Proceedings of the IEEE, 1981), weights the four cells beside the center twice as much as the four corners. Zevenbergen and Thorne fit a surface to the same nine cells in Quantitative analysis of land surface topography (1987). Their method also gives curvature. Skidmore compared the gradient methods (1989). Slope is reported in degrees or in percent rise: 45° is 100 percent.
Hillshade. Hillshade computes each cell's brightness from its slope and aspect, under a light at a chosen direction and height. Horn's 1981 paper set out the method for shaded relief maps.
Flow direction and accumulation. O'Callaghan and Mark's D8 method, in The extraction of drainage networks from digital elevation data (1984), sends all flow from a cell to the steepest of its eight neighbors. Counting the cells that drain through each cell gives flow accumulation, which traces streams. Freeman's multiple flow direction method (1991) spreads flow across all downslope neighbors, and Tarboton's D-infinity (1997) splits flow between the two neighbors closest to the steepest downhill direction. Pits, cells lower than all their neighbors, stop the routing. Barnes, Lehman, and Mulla's Priority-Flood (2014) fills pits in optimal time.
Viewshed. A viewshed marks every cell visible from an observer, by testing the line of sight to each cell. Peter Fisher showed in Algorithm and implementation uncertainty in viewshed analysis (1993) that different programs return different viewsheds from the same DEM. Visibility for a tower or a camera needs a surface model, because trees and buildings block the view.
WherobotsDB reads a DEM as a raster column and computes derivatives with map algebra in SQL. The walkthrough uses a box 8.5 km wide and 10 km tall over Boulder, Colorado, where the plains meet the Front Range foothills. Downtown lies to the east and Flagstaff Mountain to the west.
The query reads one table:
wherobots_open_data.copernicus_dem.glo_30m
GLO-30 is a surface model, so every value below is surface height in meters above EGM2008: the canopy or roof top where one exists, and the ground elsewhere.
The WherobotsDB documentation lists no built-in slope, aspect, or hillshade function. The query computes Horn's slope with RS_MapAlgebra, which runs map algebra: cell-by-cell arithmetic on a raster. Its scripts are written in the Jiffle language and can read a neighboring cell by its offset. Before the slope, the query finds the tiles, mosaics them, and converts cell size to meters:
RS_Intersects
-- Surface height and Horn slope over Boulder, Colorado, from Copernicus DEM GLO-30 WITH grid AS ( -- 360 x 324 cells of 1 arc-second on the GLO-30 cell lattice, plus a one-cell border -- so the 3 x 3 slope window has neighbors at the edges SELECT RS_MakeEmptyRaster(1, 'D', 362, 326, -105.32041666666666, 40.06041666666667, 1/3600.0, -1/3600.0, 0, 0, 4326) AS g ), tiles AS ( -- The 256 x 256 GLO-30 tiles that touch the grid, each resampled onto it SELECT /*+ BROADCAST(k) */ row_number() OVER (ORDER BY d.x, d.y) AS i, RS_ReprojectMatch(RS_SetBandNoDataValue(d.rast, 1, -32767), k.g, 'NearestNeighbor') AS r FROM wherobots_open_data.copernicus_dem.glo_30m d CROSS JOIN grid k WHERE ST_Intersects(d.footprint, ST_GeomFromText('POLYGON((-105.3205 39.9698, -105.2198 39.9698, -105.2198 40.0605, -105.3205 40.0605, -105.3205 39.9698))', 4326)) AND RS_Intersects(d.rast, RS_Envelope(k.g)) ), stack AS (SELECT RS_Union_Aggr(r, i) AS s, COUNT(*) AS n FROM tiles), dem AS ( -- Mosaic: the six tiles are bands of one raster; keep the band with data in each cell SELECT n, RS_MapAlgebra(s, 'D', 'out = max(max(max(rast[0], rast[1]), max(rast[2], rast[3])), max(rast[4], rast[5]));', -32767) AS z FROM stack ), slope AS ( -- Horn (1981) slope in degrees; rast[0][dx,dy] reads the neighbor at column offset dx, row offset dy. -- Cell size at 40.015 N on WGS84: 23.7153 m east-west, 30.8430 m north-south SELECT n, z, RS_MapAlgebra(z, 'D', 'options { outside = 0; } dzdx = ((rast[0][1,-1] + 2*rast[0][1,0] + rast[0][1,1]) - (rast[0][-1,-1] + 2*rast[0][-1,0] + rast[0][-1,1])) / (8 * 23.7153); dzdy = ((rast[0][-1,1] + 2*rast[0][0,1] + rast[0][1,1]) - (rast[0][-1,-1] + 2*rast[0][0,-1] + rast[0][1,-1])) / (8 * 30.8430); out = atan(sqrt(dzdx*dzdx + dzdy*dzdy)) * 57.29577951308232;', -9999) AS sl FROM dem ), px AS ( -- One row per cell: surface height and slope SELECT n, w, p.pos, p.c.zz AS zz, p.c.ss AS ss FROM (SELECT n, RS_Width(z) AS w, arrays_zip(RS_BandAsArray(z, 1), RS_BandAsArray(sl, 1)) AS zs FROM slope) LATERAL VIEW posexplode(transform(zs, x -> named_struct('zz', x['0'], 'ss', x['1']))) p AS pos, c ) -- Summary over the 360 x 324 interior (the border row and column are dropped) SELECT MAX(n) AS tiles, MAX(w) AS w, COUNT(*) AS cells, COUNT_IF(zz = -32767) AS nodata, MIN(zz) AS zmin, MAX(zz) AS zmax, percentile(zz, 0.5) AS zmed, AVG(ss) AS mean_slope, MAX(ss) AS max_slope, COUNT_IF(ss < 5) AS s0_5, COUNT_IF(ss >= 5 AND ss < 15) AS s5_15, COUNT_IF(ss >= 15 AND ss < 30) AS s15_30, COUNT_IF(ss >= 30) AS s30 FROM px WHERE floor(pos / 362) BETWEEN 1 AND 324 AND pos % 362 BETWEEN 1 AND 360
The query ran in 192 seconds, mosaicked 6 tiles, and returned 116,640 interior cells with no missing values:
More than half the box is flat city and plain. The steep classes sit in the foothills, where the surface climbs nearly 900 m above the lowest cell. On the flat plains, GLO-30 heights can step up at the edges of roofs, tree rows, and embankments. The slope formula reads each step as slope, which can produce the thin lines of 5° to 15°. Building-level slope for site screening needs a terrain model such as FABDEM or a 3DEP 1 m DEM.
RS_Value and RS_Values return the height or slope under points, and RS_ZonalStats returns the mean, minimum, or maximum inside parcels or footprints such as Overture buildings. Finer DEMs load with RS_FromPath as out-db rasters, which stay in their files until a query reads them. RS_Clip cuts a DEM to a boundary, and RS_Resample matches cell sizes before two DEMs are compared. Height above the nearest stream is a nearest-neighbor join between properties and a stream network. Raster and vector data run in one engine, so each of these is one query. Most stacks pick one of the two. The documentation marks RS_MapAlgebra as deprecated in favor of raster Python user-defined functions, which express the same window in NumPy.
An agent connected through the Wherobots Model Context Protocol (MCP) Server can write this SQL from a plain-language request. The models people use every day were trained on text, documents, databases, and the internet. Terrain heights joined to buildings and parcels in SQL give them facts about the physical world, the work of geospatial AI.
After Miller and Laflamme's 1958 point model, mapping agencies digitized contour maps into grids through the 1970s and 1980s. The slope, flow, and gridding algorithms cited here appeared between 1981 and 1989. Moore, Grayson, and Ladson's review Digital terrain modelling (1991) gathered them for hydrology, geomorphology, and ecology. The flow methods still disagree: D8, Freeman's method, and D-infinity give different catchment areas from the same DEM.
Satellites then replaced contour maps as the source: SRTM in 2000, ASTER and ALOS stereo coverage to high latitudes, and the TanDEM-X surface model. Bielski and colleagues ranked the 1 arc-second products with the criteria of the Digital Elevation Model Intercomparison eXercise (DEMIX). Their paper is Novel approach for ranking DEMs (IEEE Transactions on Geoscience and Remote Sensing, 2024). They found Copernicus GLO-30 and FABDEM the best overall, slightly ahead of ALOS AW3D30 and clearly ahead of NASADEM, SRTM, and ASTER. Guth and colleagues ranked ten such DEMs on slope and curvature as well as height. They published the result as Ranking of 10 global one-arc-second DEMs reveals limitations in terrain morphology representation (Remote Sensing, 2024). Two DEMs with similar height error can give different slopes and curvatures.
A DEM has error in every cell, and the error follows a spatial pattern. Fisher and Tate wrote Causes and consequences of error in digital elevation models (Progress in Physical Geography, 2006). They showed that errors pass from the input data into slope and other derivatives, and into the applications built on them. The usual accuracy statistics treat error as if it had no spatial pattern. Wechsler's review of uncertainties in DEMs for hydrologic applications (Hydrology and Earth System Sciences, 2007) set out the Monte Carlo approach. The approach adds realistic random error to the DEM many times, reruns the analysis, and reports the spread.
Surface bias, steep terrain, and time cause most of the error in global surface models:
The GLO-30 table in Wherobots holds 3.96 million tiles, according to the Data Hub introduction. The derivative algorithms were designed for grids that fit in one machine's memory. Neighborhood operations need a halo at tile edges: a border of cells from the neighboring tiles. Flow accumulation is harder: a cell's value depends on every cell upstream. Barnes adapted Priority-Flood to trillion-cell DEMs (Computers & Geosciences, 2016) and filled a 2-trillion-cell DEM on 48 cores in 4.8 hours.
Much DEM work at scale is a join of terrain values to millions of parcels, buildings, or roads. Jia Yu, Jinxuan Wu, and Mohamed Sarwat introduced spatial processing on Apache Spark with GeoSpark (ACM SIGSPATIAL 2015). Yu, Zhang, and Sarwat described its partitioning, indexing, and spatial join design in Spatial data management in Apache Spark: the GeoSpark perspective and beyond (GeoInformatica, 2019). GeoSpark became Apache Sedona, whose raster functions run the map algebra in the query above. Raster processing at scale: the out-of-database architecture behind WherobotsDB covers why a query reads only the tiles under its area of interest.
The evidence here shows that what a digital elevation model can answer depends on its model type, cell size, datum, and epoch.
Compute slope from the Copernicus DEM and join it to buildings in SQL with a Wherobots free trial at cloud.wherobots.com.
A digital elevation model (DEM) is a raster in which each cell stores the height of the Earth’s surface at that location. The grid is regular, with a known cell size and vertical datum. Global DEMs such as Copernicus GLO-30 and SRTM have 30 m cells; lidar-derived national DEMs such as USGS 3DEP reach 1 m. Slope, aspect, drainage, and visibility are all computed from a DEM.
A digital elevation model (DEM) is the general term for a raster of heights, and agencies such as the USGS use it for bare earth. A digital terrain model (DTM) is bare ground, with buildings and vegetation removed. A digital surface model (DSM) is the first surface seen from above, including rooftops and tree canopy. DSM minus DTM gives the height of buildings and trees.
A DSM records the top of whatever covers the ground: roofs, canopy, bridges. A DTM records the ground under them. Radar and stereo satellite products such as Copernicus GLO-30, SRTM, and AW3D30 are DSMs. Lidar ground returns, USGS 3DEP DEMs, and FABDEM are DTMs. Use a DSM for line of sight and a DTM for drainage and flood depth.
Digital elevation model resolution is the grid spacing. Global products such as Copernicus GLO-30, SRTM, ASTER GDEM, and AW3D30 use 1 arc-second, about 30 m. USGS 3DEP publishes 1 m DEMs from lidar and seamless 1/3, 1, and 2 arc-second layers. Vertical accuracy is a separate figure: better than 4 m (90 percent linear error) for GLO-30 and about 0.82 m RMSE for the 3DEP 1/3 arc-second layer.
Copernicus GLO-30 is free on AWS Open Data and the Copernicus Data Space Ecosystem. SRTM and NASADEM are on NASA Earthdata and USGS EarthExplorer, ASTER GDEM is on NASA Earthdata, and AW3D30 is on JAXA’s site. USGS 3DEP DEMs for the United States are on The National Map. OpenTopography serves several of these global models and academic lidar surveys.
For a free global model, independent rankings put Copernicus GLO-30 and its bare-earth derivative FABDEM first among 1 arc-second DEMs. ALOS AW3D30 comes close behind, with SRTM, NASADEM, and ASTER GDEM further back. Use GLO-30 where a surface model fits, FABDEM where bare earth matters, and lidar-derived DEMs such as USGS 3DEP wherever they exist.
The major global 30 m DEMs are free: Copernicus GLO-30, SRTM, NASADEM, ASTER GDEM, and AW3D30. FABDEM is free for non-commercial use under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 license. USGS 3DEP data are public domain. Commercial vendors sell finer surface and terrain models from stereo satellite imagery or airborne surveys.
A digital elevation model is used for flood modeling, watershed mapping, and slope and drainage screening in site selection. Telecom planners use it for line-of-sight and viewshed studies, and solar planners for sunlight and shading estimates. Paired with a surface model, it gives canopy height and biomass estimates. It is also the terrain input for correcting satellite imagery and radar.
Most global DEMs give heights above a geoid. SRTM, ASTER GDEM, and AW3D30 use EGM96; Copernicus GLO-30 and FABDEM use EGM2008. USGS 3DEP DEMs use NAVD88. Convert both models to the same datum before subtracting one DEM from another, or the offset between the datums ends up in every difference.
Slope is calculated from each cell’s 3 by 3 neighborhood. Horn’s 1981 method computes the east-west and north-south height change from weighted differences of the neighbors. The slope angle is the arctangent of the combined change. Zevenbergen and Thorne’s 1987 method fits a surface to the nine cells. On a geographic grid, convert the cell size from degrees to meters first.
What is a Geofence? How Geofencing Works, With Examples
A geofence is a virtual boundary that triggers an action when a device enters or leaves it. How geofencing works, its uses and limits, and a test on ship data.
What is Map Matching? GPS Traces, Methods and Examples
Map matching places each GPS record on the road a vehicle drove. How it works, nearest-road snapping vs hidden Markov models, and a test on Ann Arbor drives.
Geospatial Big Data: Why Analytics Is Hard to Scale
Teams struggle to scale geospatial analytics for five reasons: data volume, mixed formats, many coordinate systems, spatial joins and pipeline upkeep.
share this article
Awesome that you’d like to share our articles. Where would you like to share it to: