Skip to content

[Feature]: Shaded Relief: a rock colour on steep slopes #1913

Closed

Description

@elpidioassinaturas

Problem

A Shaded Relief with a ramp colours each cell by its height alone (Colorizer::color, the ShadedRelief arm in crates/map/src/raster.rs). A cliff or a quartzite scarp takes the colour of the height band it sits in, the same green or tan as the gentle slopes around it. Shaded relief artists, and tools like rayshader (through texture layers), tint steep ground toward rock. Rock tells the eye where the walls are before the light does, and it keeps them readable on the slopes turned from the sun.

RustGIS can do this today only in several steps: a Slope tool output, a classified layer and a blend. The result is a second layer that doesn't follow the relief's own settings.

Proposal

An optional Rock on steep slopes setting in Shaded Relief (raster.symbology "rock": {"from": 25, "to": 40, "color": "#B2ACA4"}, absent by default). Below from degrees of slope the ramp's colour is kept. Above to the rock colour is used. Between them the two are blended. The light (hillshade, cast shadows, and the sky of #1782 part 2, PR #1871) then shades that colour as it shades the ramp today.

Choices in this proposal

  • The ground's true slope, not the exaggerated one. The Z factor is for the light. Then 35° means 35° whatever the exaggeration, as a geologist reads it. The slope comes from the same 3 × 3 window and cell sizes the hillshade already uses, metres at the centre's latitude for a geographic raster.
  • A smooth step between two angles. A single threshold draws a hard outline along a contour of slope, which looks like a classified map rather than a relief.
  • 25° to 40° and #B2ACA4 when turned on. A 30 m DEM underestimates steep walls, since a cell averages a cliff with its foot. On the Ouro Preto DEM only 3.9% of cells pass 30° (99th percentile 38.4°), so 25° starts the tint on the real scarps. A light warm grey stays readable under both the sun and the shadows. Finer DEMs can raise from.
  • Blended between cells with Bilinear, like the light after the Bilinear light fix ([Bug]: Shaded Relief ignores Bilinear resampling: its light is one value per DEM cell, blocky at large scales, high DPI and in tilted views #1880).
  • Off by default, saved only when set: existing projects draw today's pixels.

Illustration (not RustGIS output)

Ouro Preto and the Itacolomi, the height ramp alone (left) and with rock from 25° to 40° (right). Drawn in Python with the same ramp, sun 315° / 30°, Z factor 1.5 and the same `base × (0.25 + 0.75 h)` light as Shaded Relief.

DEM: Copernicus DEM GLO-30, © DLR e.V. and Airbus, provided under COPERNICUS by the European Union and ESA.

Alternatives considered

  • A slope ramp in place of the height ramp (as hypsometric tints have elevation ramps). It loses the height colouring, which is the point of the map.
  • A separate Slope layer blended over it. That works today, but it's several steps, and the layer drifts from the relief's light and resampling.
  • Rock by height (above a level). It paints summits that are gentle and misses low gorges, the walls that matter.

🤖 Generated with Claude Code

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