Poland's transit will not merge: the tram network is 73% junction nodes #38
Labels
No labels
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#38
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
merge_lineswas added totransitas part of #27 and effectively did nothing for Poland.It is applied and working — it is just finding almost nothing to merge.
Poland still measures 2.1 points per feature at z9, which is the over-division signature
merge_linesexists to remove. Nothing further merges below z13 in either country (7 280 atz13 and at z9), so this is not a "merge earlier" problem.
It is not a precision problem
The first guess — sub-metre gaps between segments, so endpoints do not coincide and
ST_LineMergerefuses — is wrong. Of Poland's 16 668 segment endpoints, 15 804 (94.8%)exactly share a node with another endpoint of the same
mode. Only 64 have a neighbourunder 1 m away without touching, and 279 are isolated. The data is well connected.
It is node degree
ST_LineMergechains only through nodes of degree 2. A node where three or more linesmeet ends the chain, and that is what the two networks differ in:
73% of Poland's tram nodes are junctions, against 30% of Sweden's. BDOT10k
SKTRmodelseach track separately and splits it at every crossover and switch, which is how tram track
is actually laid — so the chains break almost everywhere by construction. No amount of
merging tolerance changes that; the graph genuinely has that shape.
Worth fixing
transitis 29 203 B of the 261 622 B z9 tile over Warszawa (11%), and 19 895 B of134 643 B at z10 (15%). For a layer that draws tram lines in a handful of cities that is a
lot.
The candidate
parallel_merge_pixels, which is what collapsed double track and yard tracks forrailways. Most of those degree-3 nodes are crossovers between the two tracks of oneline; collapse the parallel pair and the crossovers stop being junctions, which should
convert a large share of degree-3 nodes into degree-2 and let the merge run.
The obstacle is that it requires
parallel_priority, a column ranked ascending to decidewhich of two parallel chains survives, and
transithas onlymode(enum.transit_mode,metro before tram). Using
modeis semantically odd — it would mean a metro line survivesover a parallel tram line, which is defensible on a map but is not what the knob is for, and
within-mode pairs would fall through to the longer-then-stable-key tiebreak. Worth checking
whether
parallel_prioritycan simply be made optional, defaulting to longest-wins, sincethat is what this layer actually wants.
How to verify
-regeneralizemakes it cheap:transitis z9-14 and small.The degree-2 share is the thing that has to move.
zxy_map_transit(9,285,168), 29 203 B today).needs, and Stockholm's parallel metro tracks are a different case from Warsaw's trams.
transitlayers; confirm visually that noline disappears rather than merges.
Measured on the database rebuilt by the full import of 2026-08-02; background in
docs/performance.md, "Water at coarse zoom", final section.waterwaysandtransithave the same over-division as roads and rail #27PR #57 — #57