cover: exclude LMÍ's broken sea polygon, compute a valid sea from the coastline (issue #46) #61
No reviewers
Labels
No labels
claude-wip
map-report
map:is
map:se
needs-review
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
art/ismap!61
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "night/issue-46-iceland-sea-polygon"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #46
Iceland landcover: Grímsey and the NE coast rendered as sea — the LMÍ sea polygon is broken, not absorption
The report
The follow-up screenshots (comment 533) show Grímsey completely vanishing at z12
and a broken coastline at z13 on the NE coast (66.50, -16.17) — with labels,
airport, contours and roads still rendering. The maintainer's point stands: a
whole-screen island is not a sub-threshold absorption candidate at z12, so this
is not the #47/#41 bug class.
Root cause
The LMÍ landcover source contains one giant
seapolygon (533,000 km², CLC 523)clipped at the dataset's 66.5°N northern edge. The clip leaves the ring broken:
ST_IsValidfails — self-intersection at exactly the 66.5°N cut line on theNE coast (
-1775098, 10015050in 3857).(28.5 km²) and the "hole" is the 576,000 km² ocean shell.
Consequences, verified against the live DB:
ST_AsMVTGeomat tiletime, so Grímsey renders as land — by accident. But at the NE coast the
invalid ring is encoded into the tile, drawing a broken coastline at the
data cut (the second screenshot).
ST_Intersectionon sea vs land eventhrows
TopologyException: input geometry is invalid.semanticTransitionSQL,which runs
ST_Union(ST_MakeValid(geom)). MakeValid "repairs" the brokenpolygon by promoting every land loop into a solid polygon: Grímsey becomes a
28.5 km²
marine_waterpolygon with exactly the island's footprint (theisland's land polygons survive underneath, but
cover_wateris layer #19,drawn after all land layers, so the water paints over the island). The NE
peninsula loops become the 228.5/72.5/43.6 km² marine_water pieces at the
second screenshot's location.
36 marine_water polygons, same Grímsey polygon to the last digit.
The earlier #46 investigation missed it because it checked per-zoom max-Y
(which stays at Grímsey's tip because the marine_water polygon reaches it)
and feature counts, never the class of the polygon at the island — and its
zoom list skipped z12. The #47 absorb_boundary floor never sees Grímsey: it is
already water at z12, before absorption runs (z12 = z11 = z10, identical
tables).
Sibling countries are unaffected: SE (2,372), PL (41) and FI (88) sea polygons
are all valid; their z12 water/land pairs overlap only at shared edges, which
is normal for a coverage.
The fix
Exclude the
seaclass from Iceland's cover source query. The ocean is alreadythe style's background colour (
hsl(205,55%,74%)— identical to the coverwater fill), so the class is redundant as well as broken: it only ever
contributed the eaten islands, the z13 coastline artifact, and a 74,936-point
polygon shipped into every coastal tile.
Verification
Reimported Iceland's cover layer from the new config (staging strandlina → GPKG
land classes → computed sea → cascade → swap). All checks against the live DB
and a real-browser render (CDP, swiftshader, no virtual time):
map_cover_13_isis now the computed polygon: valid(
ST_IsValidtrue), 6 245 rings (one per coastline land polygon), the old533 000 km² invalid polygon is gone (17 632 land rows + 1 sea row).
discontinuous_urban, moor, airport), z12–z10 (sparse_open, scrub_grassland,
urban_fabric, industrial_commercial_transport), z9 (nature), z8–z6 (nature).
No water class anywhere on the island. The water mask's hole at Grímsey
survives to z9–z6 (
ST_Contains(mask, island_centroid)= false); at z5 themask covers it, same as the pre-fix build — no regression.
(valid, no TopologyException); z12 Grímsey (12/1843/1023) = the four land
classes + marine_water (hole); z9 Grímsey (9/230/127) = artificial + nature +
water. Tile sizes unchanged in magnitude (z12 Grímsey ≈ 5.8 KB binary).
:8080/?map=is#12.71/…and#13.18/66.50164/-16.17706): queryRenderedFeatures shows cover_water (sea)around land classes — sparse/scrub/industrial/urban_dense at Grímsey, and
sea + water_body as water with moor/sparse_vegetation as land on the NE
coast. The original z9 report location renders land + water normally.
because it unmasked the LMI landcover's coast-slop: the land polygons run
over bays and beyond the coast (the z13 table overlaps 5.6× Iceland's area;
one moor polygon covers a point 80 km offshore in Faxaflói bay), so without
a mask the z9 rollup merged the touching classes into a 426 000 km² nature
blob painting the ocean as land. The computed sea keeps the mask (and is
valid, so MakeValid never promotes its island holes).
41 / 88 rows); their z12 water–land pairs overlap only at shared edges.