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.

ESRI ASCII grid (.asc), XYZ grid text, GeoTIFF (Int16, UInt16 or Float32, one band, uncompressed or Deflate, WGS84 or UTM) or a PNG heightmap. Up to 25 MB and 1,048,576 cells.

More options

GeoTIFFs carry their own coordinate system; PNG heightmaps are always local.

Only for “WGS84 UTM zone”: zone number and N or S.

m

PNG heightmaps and TIFFs without georeferencing have no cell size of their own.

m
m
°

Clockwise from north; 315° (north-west) is the cartographic convention.

°

Multiplies elevations, e.g. 0.3048 when elevations are in feet and cells in metres.

m

Empty: a round interval giving about 10–20 levels.

m

Volumes above (cut) and below (fill) a level plane at this elevation.

A cell (“row 30, col 20”), grid coordinates “x, y” on local grids, or a coordinate in any notation on georeferenced grids.

m

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

More about this tool

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

Part of RavingDesk

  • RavingDesk Paper trading & data workspace

    Practise trading on paper and chart your data: orders, risk, datasets, analyses, reports.

    Open RavingDesk

Related tools

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.

Worked example
ResultValue
Cells96 × 80 of 30.9 × 30.7 m
Elevation range247.3 – 480.6 m
Mean / steepest slope5.59° / 19.63°
Gentle slopes (2–5°)42.07 % of the area
Slopes facing south25.89 %
Closed depressions473 cells, up to 29.11 m deep
Contours12 levels every 20 m
Visible from the observer42.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 name ravingdesk_terrain_analyzer
Example request
curl -s -X POST https://ravingdeskterrainanalyzer.usefulweb.site/api/v1/calculate \
  -H 'content-type: application/json' \
  -d '{…see OpenAPI examples…}'
Feedback · ideas & bug reports welcome