Skip to content

[Feature]: Shaded Relief: generalise the relief in the style itself (light from a smoothed DEM, no extra layer) #3145

Done

Description

@elpidioassinaturas

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.

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.

the DEM as it is, sigma 2 and sigma 4 cells

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions