Closes #22 #74
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!74
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-22-is-places-label-anchor"
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 #22
Iceland settlements: one label anchor per settlement, not per part or per tile
mannvirki_flakarmultipolygons are ST_Dump-split on import (110 source rows → 126polygons; Reykjavík alone is 6 parts), so a settlement mapped as several polygons
rendered its town name once per part, and a large settlement spanning several tiles got
one centroid label per tile. The
place_labelsstyle layer drew its text from theis/settlementspolygons, so every polygon part got a label anchor.Where the fix belongs. Issue #29 moved Iceland's name register into the shared
map_placeslayer — but that layer is the LMÍ örnefni points (44 506 points), withno multipolygon problem. The ST_Dump-split settlements live in the per-country
settlementslayer (extents + population), so the label-anchor fix goes there, in thesame shape as
airport_points.What changed.
conf/ismap.yaml: new derivedsettlement_pointslayer — a pg source overismap_settlements_12(the settlements maxz table) doingSELECT ST_Centroid(ST_Collect(geom)), nafnfitju, max(population)— one point per(name, cluster),
stop_z 4/maxz 12mirroring the polygons, with the samepopulation ladder (
>= 200at z10,>= 1000at z8,>= 4000at z6). Added to theissource. The polygon layer keeps the extents + population.GROUP BY nafnfitjualone would collapsedistinct towns that share a name — the two Reykholt (Borgarfjörður pop 84 and
Bláskógabyggð pop 368) are 155 km apart, and a nationwide name-grouped centroid
merged them into one fictional settlement with the larger population. The query
first clusters the parts spatially within each name (`ST_ClusterDBSCAN(geom, 15000,
), then groups on (name, cluster) — the same primitive #69 used for metro entrances. eps 15 km: the binding constraint is Reykjavík's 6 parts (widest gap 9.5 km, centroid span 29.7 km), comfortably below the 155 km Reykholt separation, so every multi-part settlement stays whole and the two Reykholt stay two points. The layer now emits twoReykholt` labels — correct,they are two towns.
html/style.json:place_labelsnow readssource-layer: settlement_pointsinsteadof
settlements.documented pattern, used by both
airport_pointsandsettlement_points), schema'sper-country layer list, style.md, country-iceland's layer table (also corrected the
stale
mannvirki_flakar → places, airportsrow — airports come fromsamgongur_flakar, and mannvirki_flakar feedssettlements).Verified against the live DB.
importer/importer -layer settlement_points conf/ismap.yaml).cluster) pairs, down from 126 polygon rows (109 distinct names + the second
Reykholt). Multi-part names collapse: Reykjavík 6→1, Mosfellsbær 3→1, etc.
(
Hjalteyri,Laugarbakki,Rauðalækur,Borðeyri—ibuarfj_24is empty there);the style already coalesces population to 0.
pop 84 at (-21.291, 64.665) and pop 368 at (-20.444, 64.179) — exactly the two towns
the review named. Reykjavík is one row (pop 135714).
Reykholt, z12/1815/1087 the pop-368one; z11/907/543 carries
{Reykholt, 368}alongside the settlements polygons.place_labelsare[Garðabær, Mosfellsbær, Reykjavík]— each once; at z12 eachReykholt renders its own label at its own town, and at z10 (where the
population >= 200filter applies) the pop-84 Reykholt is gone while the pop-368 one persists — thenegative control.
make build+go test ./...pass; style validates.Left undone / notes.
settlementspolygon layer stays served and unchanged; it remains the source forthe derived layer and holds the extents+population data.
source; they are distinct names so they stay distinct points — pre-existing quirk, not
changed here.
places: multi-part settlements get one label per part #22Review — changes requested
The derived-layer shape is right:
layers: [settlements]for the import-order dependency, the population ladder copied verbatim from the polygons,stop_z/maxzmirrored, the style repointed in exactly one place. That all matchesairport_pointsand I have no quarrel with it.The query has a confirmed defect, though.
GROUP BY nafnfitjumerges distinct settlements that share a name (conf/ismap.yaml:633)The grouping key is the name, nationwide — so it collapses unrelated places, not just the ST_Dump parts of one place. Iceland has such a case:
Consequences, both live at z10+ where
population >= 200lets the merged row through:max(population)reports 368 for what is now a fictional merged settlement.The verification in the PR body ("126 polygon rows → 109 distinct names") measures the collapse but cannot detect this, because it assumes one name means one place.
Fix
Same primitive #75 just landed for the metro entrances — cluster spatially within the name, then group on the cluster:
An
epsin the low tens of km separates the two Reykholts while keeping Reykjavík's 6 parts (29.7 km span) and Hafnarfjörður's 2 (14.8 km) together; the spans are worth checking before picking the number, since Reykjavík's own span is the binding constraint. Note this makes the layer emit twoReykholtpoints, which is correct — they are two towns.Worth re-running the name-count verification afterwards as "distinct (name, cluster)" rather than "distinct name".
5d66897649tobdf9498525Fixed on the branch —
settlement_pointsnow clusters spatially within the name before grouping:eps 15 km, chosen against the live spans: Reykjavík's 6 parts are the binding constraint (widest gap 9.5 km between two parts, 29.7 km centroid span; Hafnarfjörður's 2 parts gap 0) and must stay one label; the two Reykholt are 155 km apart. 15 km sits between, so every multi-part settlement stays whole and the Reykholts split — the layer now emits two Reykholt points, which is correct.
Verified against the live DB (reimported the single layer):
Docs and the PR body now describe the layer as "one centroid per (name, cluster)" with the two Reykholt named as the case.