Repository navigation
Description
A definition query hides a lake, but the ground still holds it
terrain::water::polygons reads every row of the water layer (layer.dataset.features). The fill applies the layer's row eligibility (definition query; display filter and view distance go the same way in draw_chunk), but the water does not. A lake the layer no longer draws:
- still lies flat at its level (feat(terrain): water bodies lie flat at their level (part of #1915) #2085);
- is still lit as flat ground (feat(render): Shaded Relief lights the terrain's water as flat ground (#1915 part 2) #2218);
- still has its shore band (feat(render): a soft sun glint on the terrain's water in a tilted view (#1915 part 3) #2230 / feat(render): a darker band along the terrain's water's shore (#1915 part 4) #2284): a dark outline around a lake that isn't there.
Steps (rustgis-cli, cop30_venda_nova.tif + lagos.geojson, 125 polygons):
rustgis-cli run --data cop30_venda_nova.tif --data lagos.geojson \
--cmd 'raster.symbology={"layer":"cop30_venda_nova","type":"shadedRelief","azimuth":315,"altitude":45,"zFactor":1.5}' \
--cmd 'layer.color={"layer":"lagos","color":"#1F5FA880"}' \
--cmd 'layer.definitionQuery={"layer":"lagos","where":"AREA_HA < 17"}' \
--cmd 'map.terrain={"layer":"cop30_venda_nova","exaggeration":2,"water":{"layer":"lagos","shore":0.6}}' \
--cmd 'map.goToXY={"lon":-41.1492,"lat":-20.3019,"scale":12000}' \
--cmd 'share.exportMap={"path":"definition_query.png","width":1600,"height":1000}'
The query hides the 17.4 ha reservoir. Its fill is gone, but its shape stays: lit flat with no relief texture, and outlined by the shore band.
A project naming a streamed layer as the water reads it from the view's sample
map.terrain refuses a layer read a view at a time ("'…' is read a view at a time: water needs a layer that holds all its polygons"). Reading a project doesn't apply that check. A .rgis whose view.terrain.water.layer names a streamed layer (a hand edit, another tool, or a newer writer) opens without a word. Its water then comes from the rows the view happens to hold.
Steps:
- Make a shapefile above
STREAM_ABOVE(100,000 rows): the 125 lakes plus 300,000 tiny squares spread over the DEM. Adding it says "300125 features, read in place a view at a time". - Save a project with terrain from the DEM (no water), then set
maps[0].view.terrain.water = {"layer":"lagos_near","shore":0.6}in the file. - Reference: the same data with
layer.loadAllbeforemap.terrainand saved (the layer is then kept whole in the project). - Open each and export the whole DEM (
map.goToXYscale 60,000, 3200 × 2000).
At 1:12,000 (about 7,000 rows in view) the two exports are identical pixel for pixel. With the whole DEM in view (all 300,125 rows, above VIEW_LIMIT 250,000), they differ in 157,396 pixels. In the streamed one the reservoir, which fell outside the view's sample, keeps its fill but is not flat, not lit flat, and has no band. In the reference it has all three. Which lakes drop changes with the sample.
Not reachable through layer.repairSource: a small layer is kept in the project, and the command refuses it ("there's no file to repair").
Choices in this proposal
-
Build the water from the rows the layer draws: apply the same row eligibility as the fill (definition query, display filter, view distance) in
polygons(). Key theWatercache on that rule as well as the rows, so a query change rebuilds it. One rule for the in-memory and the complete-source paths. -
On project read, apply
map.terrain's check: water naming a layer read a view at a time is dropped with a notice, as other unusable settings are ("Water: 'lagos_near' is read a view at a time; load all its features and set the water again"). Don't render water from a view's sample. -
Not proposed: reading the water from the complete source of a streamed layer. The command already refuses such a layer, and holding every polygon is the point of that refusal.
-
Related: feat(terrain): water bodies lie flat at their level (part of #1915) #2085 (part 1), feat(render): Shaded Relief lights the terrain's water as flat ground (#1915 part 2) #2218, feat(render): a soft sun glint on the terrain's water in a tilted view (#1915 part 3) #2230, feat(render): a darker band along the terrain's water's shore (#1915 part 4) #2284 (CodeRabbit threads there).
Activity
fix(terrain): keep the water's kept rows between views; streamed wate…
fix(terrain): water is the rows its layer draws; streamed water dropp…
Merge origin/main into feat/2317-block-wall-water