# #82: roads.surface is manufactured where the source is silent #89
No reviewers
Labels
No labels
blocked
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!89
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-82-surface-null"
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?
#82: roads.surface is manufactured where the source is silent
Closes #82
What changed
Three roads surface CASEs audited per R66. Two needed a fix, one is verified already total.
Poland —
conf/plmap.yaml(the real manufacturing)The surface CASE was
CASE WHEN materialnawierzchni IN (6 paved values) THEN 'paved' ELSE 'unpaved' END. The ELSE branch was reached by:grunt naturalny/tłuczeń/żwir— genuinely unpaved (natural ground, crushed stone, gravel) — fine;inny("other") — 1108 rows with no corresponding surface class;Both of the latter were being asserted as
unpaved, i.e. a default silently manufactured where the source is silent. The ELSE is now an explicit list of the three genuinely-unpaved values, and anything else (includinginnyand NULL) imports as NULL surface.Before:
plhad 0 NULL surfaces. After: 2497 NULLs = 1389 rows with noMATERIALNAWIERZCHNI+ 1108 rows whose value isinny("other"), a value with no surface class (R66: "a categorical column with no corresponding source value imports as NULL").Iceland —
conf/ismap.yaml(defensive, no data change)The mapping
A/B/C → paved, D/F1/F2/F3 → unpavedwas already an exhaustive IN overvegtegund(R43), andvegtegundis complete in the delivery (0 NULL/empty). But the old CASE's ELSE would have manufacturedunpavedfor a NULLvegtegundif one ever appeared. The CASE now enumerates both classes explicitly and emits NULL for a NULL/emptyvegtegund. 0 NULLs result — correct, because the source genuinely records a class on every row.Finland —
conf/fimap.yaml(verified total, no change)CASE WHEN p.LINK_ID IS NOT NULL THEN 'paved' ELSE 'unpaved' ENDreads presence in Digiroad's own paved-roads overlay (DR_PAALLYSTETTY_TIE_K). Digiroad's model is that gravel roads get no row at all, so absence is the value "unpaved" — a total CASE by the source's own definition (R43), not a manufactured default. Verified against the data: every motorway (LINKKITYYP 1), semi-motorway (2) and main road (TOIMINN 1–3) is present in the overlay; the absent rows are predominantly private roads and vehicle tracks, which genuinely are gravel. 0 NULLs correct.Verification (live DB)
roadslayer forisandpl(-layer roads, atomic swap).map_roads_14surface distribution per country:pl_skjzhas 1389 rows with NULL/emptyMATERIALNAWIERZCHNI+ 1108 withinny= 2497.zxy_map(14, 9062, 5558), a Poland trunk with NULL surface): roads features carrypaved/unpaved/absent surface as expected.?map=pl): a trunk road with NULL surface draws as a normal trunk and is excluded from the brown dashedroads_unpavedoverlay — the same behaviour Sweden's 91 NULL rows already exercise. Style has no NULL-surface predicate, so nothing else needed changing.make build,go test ./...inimporter/andmapsrv/: pass.Notes / things left
inny("other") value decision: BDOT10k definesMATERIALNAWIERZCHNIwith ten values; the config comment previously said "nine" and never accounted forinnyor NULL.innyhas no corresponding surface class, so it imports as NULL rather than being guessed.docs/country-iceland.md/docs/workstream-a.mdupdated to record the R66 reasoning next to the queries.R66 audit of the three roads surface CASEs. Poland was the real manufacturing: the ELSE ('unpaved') was reached by 1389 rows whose MATERIALNAWIERZCHNI is NULL and 1108 rows whose value is `inny` ("other") — neither genuinely carries 'unpaved'. The CASE now lists the three genuinely-unpaved values explicitly and ELSE NULL, so pl gains 2497 NULL surfaces (1389 absent + 1108 other), matching the source. Iceland's mapping was already an exhaustive IN over vegtegund (R43), but its ELSE would have manufactured 'unpaved' for a NULL vegtegund; the CASE now enumerates both classes and emits NULL for NULL/empty vegtegund. vegtegund is complete in the delivery, so 0 NULLs is correct — the ELSE is never reached by a silent row. Finland was verified already-total, no change: presence in Digiroad's own paved-roads overlay means paved and absence means unpaved by the source's own definition (all motorways/trunks present; absent rows are private roads and tracks, which genuinely are gravel). Verified against the live DB: reimported roads for is and pl, surface NULL counts match the source exactly (pl 2497), partitions at every zoom, decoded tile, real-browser render showing a NULL-surface trunk drawn as normal trunk and excluded from the roads_unpaved overlay.roads.surfaceis manufactured where the source is silent, in Iceland, Poland and Finland #82