Premium apps Part of RavingDesk
RavingDesk Terrain Analyzer (DEM slope, aspect, hillshade, contours)
Slope, aspect, hillshade, curvature, sinks and contour lines from your elevation model.
Try an example: Synthetic hills (ESRI ASCII grid, 25 m cells): slope, aspect, hillshade and 20 m contours · The same terrain as a WGS84 GeoTIFF: slope map and the viewshed from a hilltop · A V-shaped valley from XYZ points: cut and fill against a 60 m level plane
How it works
Reads a digital elevation model you supply — ESRI ASCII grid, XYZ grid, GeoTIFF (WGS84 or UTM) or a Terrarium/Mapbox/grey PNG heightmap — and computes slope and aspect with Horn’s method, a hillshade for any sun position, Zevenbergen–Thorne curvature, closed depressions with Priority-Flood, contour lines as GeoJSON, and optionally cut/fill volumes against a reference elevation and a viewshed from an observer with earth curvature and refraction. Returns statistics, a PNG map and the contours. It is the terrain engine of RavingDesk’s Data & charts “Terrain” step.
- DEM reading: ESRI ASCII grids (xll/yll corner or centre, cellsize or dx/dy, NODATA_value); XYZ points on a regular grid (cell centres; missing positions become no data); GeoTIFF subset (one band of Int16, UInt16 or Float32, uncompressed or Deflate, strips or tiles, predictors 1–3, ModelTiepoint + ModelPixelScale or a north-up ModelTransformation, WGS84 EPSG:4326 or WGS84 UTM EPSG:326xx/327xx; other coordinate systems, LZW, BigTIFF and rotated grids are refused with a reason); PNG heightmaps (Terrarium, Mapbox Terrain-RGB or grey; transparent pixels are no data). Only files you supply are read — nothing is downloaded.
- Slope and aspect follow Horn (1981): dz/dx = ((c + 2f + i) − (a + 2d + g)) / (8·Δx) and dz/dy = ((a + 2b + c) − (g + 2h + i)) / (8·Δy) over the 3 × 3 window; slope = atan(√(dz/dx² + dz/dy²)); aspect is the compass direction the slope faces (0° = north, 90° = east), flat cells have none. Edge and no-data neighbours take the centre value.
- Hillshade = 255 · (cos Z · cos S + sin Z · sin S · cos(azimuth − aspect)) with Z = 90° − sun altitude; curvature = −2·(D + E) after Zevenbergen & Thorne (1987) in 1/m (positive = convex; Esri reports 100× this value).
- Closed depressions are filled with Priority-Flood (Barnes, Lehman & Mulla 2014): starting from the grid edge in rising order, every cell lower than its spill level is raised to it; the fill depth and volume are reported. Contours are traced with marching squares on the cell centres (saddles resolved by the mean of the four corners).
- Cut/fill: Σ (z − reference) · cell area above the plane (cut) and below it (fill). Viewshed: rays from the observer to every edge cell (Franklin & Ray’s R2 scheme) with interpolation between the two straddling cells; a cell is visible when its elevation angle is not below the steepest angle before it; the earth-curvature drop is d²/(2R)·(1 − k) with R = 6,371,008.8 m and k = 0.13.
- Cell sizes on geographic grids come from the WGS84 radii of curvature at each row (meridional M and prime vertical N·cos φ) and cell areas from the exact ellipsoidal quadrangle; UTM and local grids use map metres (the UTM scale factor of 0.9996–1.0004 is ignored).
Sources
- Hill shading and the reflectance map (Proc. IEEE 69(1), 14–47) (B. K. P. Horn, 1981)
- Priority-Flood: an optimal depression-filling and watershed-labeling algorithm for digital elevation models (Computers & Geosciences 62, 117–127) (R. Barnes, C. Lehman, D. Mulla, 2014)
- The extraction of drainage networks from digital elevation data (CVGIP 28, 323–344) (J. F. O’Callaghan and D. M. Mark, 1984)
- Quantitative analysis of land surface topography (Earth Surface Processes and Landforms 12, 47–56) (L. W. Zevenbergen and C. R. Thorne, 1987)
- GeoTIFF format specification 1.0 / OGC GeoTIFF 1.1 (Open Geospatial Consortium)
- Esri ASCII raster format (Esri)
Part of RavingDesk
-
RavingDesk Paper trading & data workspace
Practise trading on paper and chart your data: orders, risk, datasets, analyses, reports.
Related tools
- RavingDesk Watershed & Stream Network (D8 from a DEM) – Fill sinks, route flow (D8) and delineate the watershed and streams above a pour point.
- RavingDesk Elevation Profile from a DEM – Elevation profile along a line over your DEM: CSV, chart, climb, descent and grades.
- RavingDesk Geodesic Distance & Bearing Calculator – Exact distance, bearings and midpoint between coordinates or along a route on WGS84.
- Voxel Height Grid Builder – Build an editable voxel model from rows of integer heights.
How to use the RavingDesk Terrain Analyzer
Turn your own elevation model into slope, aspect, hillshade and curvature statistics, a PNG map and contour lines, with optional cut/fill volumes and a viewshed.
What it is for
A digital elevation model (DEM) is a grid of heights. On its own it is hard to read: you want to know how steep the ground is, which way the slopes face, where water would collect, and where the contour lines run. The terrain analyzer answers those questions for a file you supply.
It reads an ESRI ASCII grid (.asc), XYZ points on a regular grid, a GeoTIFF with one band of Int16, UInt16 or Float32 heights (uncompressed or Deflate, in WGS84 longitude/latitude or a WGS84 UTM zone), or a PNG heightmap in Terrarium, Mapbox Terrain-RGB or grey encoding. Nothing is downloaded: no tiles are fetched from any server.
You get slope and aspect statistics, a hillshade, curvature, the closed depressions a fill would remove, contour lines as GeoJSON and a PNG map of the layer you choose. Optionally it adds cut and fill volumes against a level plane and a viewshed from an observer.
Worked example
The second example is a synthetic test terrain (96 × 80 cells, 1″ spacing, deliberately placed at 0° N, 0° E so nobody mistakes it for a real place) as a WGS84 GeoTIFF, with the observer on the north-west hilltop at row 25, col 25, 2 m above the ground.
| Result | Value |
|---|---|
| Cells | 96 × 80 of 30.9 × 30.7 m |
| Elevation range | 247.3 – 480.6 m |
| Mean / steepest slope | 5.59° / 19.63° |
| Gentle slopes (2–5°) | 42.07 % of the area |
| Slopes facing south | 25.89 % |
| Closed depressions | 473 cells, up to 29.11 m deep |
| Contours | 12 levels every 20 m |
| Visible from the observer | 42.4 % (3.0963 km²), farthest cell 2.77 km away |
The cell size in metres comes from the WGS84 ellipsoid: one arc-second is 30.9 m east–west at the equator but 30.7 m north–south. The third example reads a V-shaped valley from XYZ points and compares it with a level plane at 60 m: 178,000 m³ of cut and 36,000 m³ of fill.
How to read the result
- Slope is the steepest gradient at each cell, computed with Horn's 3 × 3 method. The slope classes table shows how much of the area is flat, gentle, moderate or steep.
- Aspect is the compass direction a slope faces: a south-facing slope gets more sun in the northern hemisphere. Flat cells have no aspect.
- Closed depressions are pits with no outlet. The fill depth is how much water they would hold before spilling. In real data many are small artefacts.
- Curvature is positive on ridges and hilltops and negative in hollows, in 1/m.
- Cut is the volume above the reference plane, fill the volume below it.
Tips and common mistakes
- Feet on a metre grid distort every slope. Set the z factor to 0.3048.
- An ASCII grid in degrees is detected automatically. If yours is a projected grid in a UTM zone, choose "WGS84 UTM zone" and enter the zone, such as
33N. - GeoTIFFs in other coordinate systems (for example EPSG:3857 or a national grid) are refused with a clear message. Reproject them first with
gdalwarp. - The viewshed uses ray casting on the bare surface. Trees and buildings are not part of a DEM, so real views are usually smaller.
- Large grids take longer. The tools accept up to 1,048,576 cells.
FAQ
Why does a PNG heightmap have no coordinates?
PNG files carry pixels only. The tool treats them as a local grid with the cell size you enter. Use a GeoTIFF when you need latitude and longitude.
What do Terrarium and Mapbox Terrain-RGB mean?
They store heights in the red, green and blue channels. Terrarium uses R·256 + G + B/256 − 32768 metres; Mapbox uses −10000 + (R·65536 + G·256 + B) · 0.1.
Can I get the watershed of a point?
Yes, with the RavingDesk Watershed tool, which uses the same engine.
Where can I see the map interactively?
In RavingDesk, add a Terrain step under Data & charts. It runs the same calculations in your browser.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://ravingdeskterrainanalyzer.usefulweb.site/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://ravingdeskterrainanalyzer.usefulweb.site/mcp· tool nameravingdesk_terrain_analyzer
Example request
curl -s -X POST https://ravingdeskterrainanalyzer.usefulweb.site/api/v1/calculate \
-H 'content-type: application/json' \
-d '{…see OpenAPI examples…}'