Repository navigation
Description
Problem
A relief map at a small scale wants fewer, larger landforms: the regional valleys and ranges, not every gully. A DEM drawn as it is shows every gully, and at 1:100,000 or smaller the map turns into noise.
In RustGIS that means running a filter tool and drawing the new layer instead of the DEM. That's one more layer per scale to keep in step, its own symbology and stretch to set, and redone if the area changes. Eduard puts generalisation on two sliders in the shading itself (Macro and Micro), and that is how a cartographer wants to work: try a level and see.
Proposal
A new setting, Generalise (raster.symbology "generalize", metres, default 0 = off): the Shaded Relief works its light (hillshade, and the other lights read from slopes) out from the DEM smoothed with a Gaussian of that size. The colour ramp still reads the DEM's own heights, so the hypsometric tints don't move.
- The smoothed grid is worked out once per layer and size, off the frame, and kept like the cast-shadow grids (feat(raster): Shaded Relief casts soft shadows (#1782, part 1) #1796). The map draws without it meanwhile, and exports wait for it.
- Cast shadows and the sky read the smoothed grid too, so their shapes match the light.
Choices in this proposal
- A Gaussian, in metres. Metres make sense at any cell size, and a Gaussian is cheap at any radius with box passes (the existing Fast Almost Gaussian Filter's method). In the demonstration below it removed the gullies and kept the valleys.
- The light only, not the heights' colours. Smoothing the colours would shift the height bands the reader uses to read the map.
- One setting first. Eduard's Macro/Micro pair (regional forms, local detail) could follow as a second setting for a smaller detail scale, once one is in use.
- Off by default. Existing maps don't change.
Demonstration with today's tools
Copernicus DEM GLO-30, Ouro Preto (Minas Gerais), UTM 23S at 30 m. Fast Almost Gaussian Filter on the DEM, then Shaded Relief on the result (hypsometric ramp, sun 315° / 40°, Z factor 1.5), 1:100,000. Grey level's standard deviation (relief contrast):
| Std. deviation | |
|---|---|
| DEM as it is | 37.7 |
| Sigma 2 cells (60 m) | 32.2 |
| Sigma 4 cells (120 m) | 27.1 |
The whole rustgis-cli run (open, filter the 1924 × 1829 DEM, draw, export) took 1.6 s unsmoothed, 3.6–3.7 s with sigma 2 and 5.1 s with sigma 4, two runs each. One sigma-4 run took 14.5 s on a busy PC.
DEM: Copernicus DEM GLO-30, © DLR e.V. and Airbus, provided under COPERNICUS by the European Union and ESA.
Limits
A Gaussian rounds ridges and valley floors alike. Sharp crests with smooth slopes, the Swiss look, need an edge-preserving smoothing. RustGIS's Feature Preserving Smoothing is the obvious candidate. With its defaults (window 11, 3 iterations) it left dark stepped streaks on this DEM in my test, so I left it out of the proposal until that's understood.
Alternatives considered
- A pyramid level (a coarser overview) for the light. It's cheap, but it steps at the overview's cells and changes with zoom.
- Keep it a tool. That's today's workflow, a layer per scale.
🤖 Generated with Claude Code
Activity
fix(render): a generalised relief keeps its size past 256 cells, roun…
feat(render): a generalised Shaded Relief lights its heights smoothed…
fix(render): a generalisation out of range in a file draws within it,…
fix(render): a part read in place stays on its level however wide the…
fix(render): a generalised relief's blocks don't depend on the thread…
fix(render): a view narrower than a generalised relief's block reads …
perf(render): a generalised relief reads at most 2^24 cells a draw, i…
feat(engine): raster.symbology sets a Shaded Relief's generalisation,…
test(engine): a file holding a generalisation out of range is read as…
fix(engine): an offline area's map is set and said like a project's w…
fix(map): a generalised relief's whole-grid smoothing plans its memor…
fix(map): a generalised relief's smoothing plans for its whole work s…
fix(map): a generalised relief's block past 2^24 cells keeps its mean (…
fix(ui): a Shaded Relief's Generalise row comes after flat ground's d…
docs(ui): the Generalise pane test's doc drops its review reference (o…
feat(render): a generalisation's pad read in place is cut to what fit…
fix(ui): an arrow key's step past a relief field's end sends the end (o…
feat(map): a generalised relief casts its shadows and sees its sky fr…
feat(ui): a Generalise field in a Shaded Relief's style pane, and the…
fix(map): a shared smoothing keeps only heights, and is shared only w…
fix(map): a grid reading another's smoothing plans its own trace, and…
fix(map): a trace refused over shared heights says it is the trace, a…
Plan every trace on shared smoothed heights; saturate cell counts
Count traces on shared heights only while they run
Say what a trace refusal's bytes count
perf(map): a generalised relief's shadows and sky share one smoothed …