Closes #120 #131
No reviewers
Labels
No labels
blocked
claude-wip
map-report
map:is
map:se
needs-review
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
art/ismap!131
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-120-is-cover-validity"
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 #120
What and why
Iceland's
map_cover_13_ishad exactly one invalid geometry: a CLC 522 estuary(ring self-intersection, 64.31°N / 14.93°W) found by #115's first acceptance-test
pass and deliberately left unguarded by #119 because it failed against live data.
The source is broken, not the importer. Before repairing anything I checked the
delivered file:
data/is_lcv_lmi_epsg_4326.gpkgrow id 14109 (lcv_class 522) isRing Self-intersectionat -14.915589 / 64.327391 — LMÍ ships the polygon invalid.So the fix belongs in the ismap cover query, exactly as the issue proposed.
The mechanism. The cover layer's landcover source read the GeoPackage directly,
which executes the source query in SQLite — there is no
ST_MakeValidthere. Thesource now reads the new
is_lcv_lmi_landcoverunitstaging table (a byte-identicalload of the same rows and codes; only the repair moved into SQL) through PostGIS,
and the layer query applies R139's pattern:
ST_MakeValidper source polygon +ST_CollectionExtract(..., 3)so a self-intersecting ring cannot leak straylinework into the typed Polygon column, then the usual
ST_Dump/ST_Transform.The CLC-code →
cover_classmapping the Go-side enum map used to apply moved intothe query as a CASE (the canonical vocabulary from
conf/common.yamlenums.landcover; the CASE lists exactly the 32 codes that occur). The unusable523 sea stays excluded, and the computed-sea source is untouched.
Verification (live DB, after
importer/importer -layer cover conf/ismap.yaml, ~2 min)(identical to the pre-fix snapshot); 0 NULL
cover_class;part_keyall NULLas designed.
for all 31 land classes (0 mismatches); the repaired estuary keeps its
10 301 668 m².
zxy_map_cover(13, 3756, 2167)over the estuary decodescleanly — 11 cover features including the repaired
estuaryand the sea.scripts/cdp-map-check.mjs, CDP, no virtual time):?map=is#13/64.3274/-14.9156loads, tiles load, 209 rendered cover featuresincluding 4
estuaryfeatures at the exact location.acceptance: 12 test(s): 12 passed, 0 failed, 0 skipped, 0 not run(the new test itself: PASS 2.5s, invalid=0). Repo-wide fast acceptance: every
config green; Sweden's R35 (the 5.4M-row validity check, 100s bucket) still
passes via
-acceptance-only -acceptance all conf/semap.yaml.The acceptance test
The test #119 deliberately did not ship now lands on Iceland's
coverlayer:R139: Iceland's maxz cover has 0 invalid geometries (issue #120)— 10 s bucket(2.5 s live),
requires: [map_cover_13_<cc>],count(*) = 0overmap_cover_13_is WHERE NOT ST_IsValid(geom). It fails on the pre-fix data andpasses now.
Notes
is_lcv_lmi_landcoverunitstaging table persists in the DB likestrandlina/mork/fi_clc— that is the designed behavior for load-kindstaging.
-layer coverreimport also rebuiltstrandlina(a staging dep of thesea source) — a deterministic reload of the same gpkg, no content change.