Repository navigation
Closed
Description
Problem
Water bodies on a relief map are drawn today as an ordinary polygon layer over the Shaded Relief or the draped terrain:
- Tilted views raise the water with the DEM. Global DEMs such as Copernicus GLO-30 are surface models, often noisy or stepped over water, so a reservoir ripples and tilts with them. A polygon draped over the terrain follows every bump.
- The relief's light reaches the water. With a semi-transparent water fill, or a fill blended with the relief (
layer.blend), the hillshade and cast shadows (feat(raster): Shaded Relief casts soft shadows (#1782, part 1) #1796) show through, and the lake gets slopes and shadows it doesn't have. - Nothing tells water from land but the colour. Relief tools (rayshader's
add_waterand its water rendering) draw water flat, unlit by the terrain, with a little shine from the sun. That is what makes a lake read as water at a glance.
Proposal
A water option on the terrain (map.terrain "water": {"layer": "lagos", ...}, off by default), naming a polygon layer:
- Flat at its level. Inside each polygon, the terrain's height (
terrain::Ground) is the polygon's level: the lowest DEM height along its outline (the shore), or a numeric field given as"level". Tilted views then draw the lake flat, and the shore meets the land. - Not lit by the relief. Shaded Relief draws the water's cells with a fixed light, the flat ground's own, with no hillshade or cast shadow. The water layer's own symbology gives its colour as usual.
- A soft glint. A tilted view adds a highlight where the sun would reflect toward the eye, broad and faint (
"glint", 0 to 1, default 0.3), so the water shines a little on the sun's side. - A darker shore band a few pixels wide inside the outline, as relief artists draw it (
"shore", on by default whenwateris set).
Choices in this proposal
- Water from a polygon layer, not detected from the DEM. Real water bodies exist as data (national hydrography, OpenStreetMap). Detecting flat cells, as rayshader's
detect_waterdoes, also takes floodplains, airfields and flat roofs for lakes. Detection could follow as a tool that writes such a layer. - The level from the shore's lowest height. It is the water's surface where the DEM is right, at the edge. A field overrides it for a reservoir with a known level.
- Rivers stay lines. A line layer is already drawn over the relief. Flattening a river's corridor would need its width, which a line doesn't have.
- Off by default. Nothing changes for existing maps.
Not measured
I haven't prototyped this. The costs to check are reading each water polygon's level once, when the layer or the terrain changes, and a point-in-polygon test per mesh vertex and per cell. For both, a rasterised mask at the DEM's resolution would keep the per-cell test to a lookup.
Alternatives considered
- Bathymetry under the water, with depth tints. It needs depth data most users don't have. It could build on this later.
- Doing it all in the water layer's symbology. The layer can't flatten the terrain or stop the relief's light: both belong to the terrain and the relief.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
No labels
Activity
feat(terrain): water bodies lie flat at their level (part of opengeos…
fix(terrain): water review round 1 (part of opengeos#1915)
fix(terrain): a failed shore tile doesn't re-read the water every sec…
fix(terrain): a failed shore tile is asked again; coarse shores said …
fix(terrain): a real shore budget; a deleted level field is said (par…
fix(terrain): "water": null is left out, as for the exaggeration (par…
fix(terrain): strip count can't overflow; map.terrain says why it sta…
fix(terrain): water: None in the Ground literals main's opengeos#2037 …
docs(terrain): one wider step for a water layer's shores, and the 60 …
test(terrain): a schema fixture with water on the terrain, read back …
fix(terrain): water review on the ready PR (part of opengeos#1915)
feat(terrain): water bodies lie flat at their level (part of #1915) (#…
fix(render): water light by cell centre, kept per cell, and waited for (
feat(render): Shaded Relief lights the terrain's water as flat ground (…
fix(render): the glint's sun from a relief layer drawn at the view's …
docs(maps): which relief layer gives the glint's sun; the glint test …
feat(render): a soft sun glint on the terrain's water in a tilted view (
fix(render): shore band with the water layer's composition; read only…
fix(render): the shore band fades inward at shore 1 too: a tone per s…
fix(render): a lake with a vertex that isn't a number takes no shore …
feat(render): a darker band along the terrain's water's shore (openge…