discontinous railways #3

Closed
opened 2026-08-01 08:48:04 +00:00 by map-issues-bot · 3 comments
Collaborator

Polish railways have sections disappear at z10. Every part I've seen where this happens has more tracks than the sections that remain visible. Question is, rather than rendering the "smaller" tracks, wouldn't it make sense to merge both railways and roads with close parallel lines into one thicker/higher priority one and that would solve this problem?


Location: z14 / 52.43021 / 21.42863
Area: circle r=1268 m @ 52.31349, 21.15892

{
 "features": [
  {
   "geometry": {
    "type": "Polygon",
    "coordinates": [
     [
      [
       21.177549805571644,
       52.31348884188793
      ],
      [
       21.17746008112946,
       52.31460538422692
      ],
      [
       21.177191771898332,
       52.31571117365282
      ],
      [
       21.176747461842837,
       52.31679556080898
      ],
      [
       21.176131429911685,
       52.31784810245429
      ],
      [
       21.175349608829137,
       52.31885866203733
      ],
      [
       21.174409527959597,
       52.31981750731689
      ],
      [
       21.173320240795746,
       52.32071540408877
      ],
      [
       21.172092237768435,
       52.32154370511622
      ],
      [
       21.17073734521811,
       52.322294433407535
      ],
      [
       21.169268611500694,
       52.322960359038895
      ],
      [
       21.167700181324772,
       52.323535068782434
      ],
      [
       21.166047159530336,
       52.32401302786916
      ],
      [
       21.16432546562089,
       52.324389633291766
      ],
      [
       21.16255168044997,
       52.324661258134185
      ],
      [
       21.160742886538404,
       52.32482528650068
      ],
      [
       21.158916503560363,
       52.32488013870843
      ],
      [
       21.15709012058232,
       52.32482528650068
      ],
      [
       21.155281326670757,
       52.324661258134185
      ],
      [
       21.153507541499835,
       52.324389633291766
      ],
      [
       21.15178584759039,
       52.32401302786916
      ],
      [
       21.150132825795954,
       52.323535068782434
      ],
      [
       21.14856439562003,
       52.322960359038895
      ],
      [
       21.147095661902615,
       52.322294433407535
      ],
      [
       21.14574076935229,
       52.32154370511622
      ],
      [
       21.14451276632498,
       52.32071540408877
      ],
      [
       21.14342347916113,
       52.31981750731689
      ],
      [
       21.14248339829159,
       52.31885866203733
      ],
      [
       21.14170157720904,
       52.31784810245429
      ],
      [
       21.14108554527789,
       52.31679556080898
      ],
      [
       21.140641235222393,
       52.31571117365282
      ],
      [
       21.140372925991265,
       52.31460538422692
      ],
      [
       21.14028320154908,
       52.31348884188793
      ],
      [
       21.140372925991265,
       52.31237229954894
      ],
      [
       21.140641235222393,
       52.31126651012304
      ],
      [
       21.14108554527789,
       52.310182122966886
      ],
      [
       21.14170157720904,
       52.30912958132157
      ],
      [
       21.14248339829159,
       52.308119021738534
      ],
      [
       21.14342347916113,
       52.30716017645897
      ],
      [
       21.14451276632498,
       52.30626227968709
      ],
      [
       21.14574076935229,
       52.30543397865964
      ],
      [
       21.147095661902615,
       52.30468325036833
      ],
      [
       21.14856439562003,
       52.30401732473697
      ],
      [
       21.150132825795954,
       52.30344261499343
      ],
      [
       21.15178584759039,
       52.302964655906706
      ],
      [
       21.153507541499835,
       52.3025880504841
      ],
      [
       21.155281326670757,
       52.30231642564168
      ],
      [
       21.15709012058232,
       52.30215239727518
      ],
      [
       21.158916503560363,
       52.30209754506743
      ],
      [
       21.160742886538404,
       52.30215239727518
      ],
      [
       21.16255168044997,
       52.30231642564168
      ],
      [
       21.16432546562089,
       52.3025880504841
      ],
      [
       21.166047159530336,
       52.302964655906706
      ],
      [
       21.167700181324772,
       52.30344261499343
      ],
      [
       21.169268611500694,
       52.30401732473697
      ],
      [
       21.17073734521811,
       52.30468325036833
      ],
      [
       21.172092237768435,
       52.30543397865964
      ],
      [
       21.173320240795746,
       52.30626227968709
      ],
      [
       21.174409527959597,
       52.30716017645897
      ],
      [
       21.175349608829137,
       52.308119021738534
      ],
      [
       21.176131429911685,
       52.30912958132157
      ],
      [
       21.176747461842837,
       52.310182122966886
      ],
      [
       21.177191771898332,
       52.31126651012304
      ],
      [
       21.17746008112946,
       52.31237229954894
      ],
      [
       21.177549805571644,
       52.31348884188793
      ]
     ]
    ]
   },
   "properties": {
    "_kind": "selection-circle",
    "_radius_m": 1268
   },
   "type": "Feature"
  }
 ],
 "properties": {
  "lat": 52.430206,
  "lng": 21.428629,
  "map": "is",
  "zoom": 13.81
 },
 "type": "FeatureCollection"
}
Polish railways have sections disappear at z10. Every part I've seen where this happens has more tracks than the sections that remain visible. Question is, rather than rendering the "smaller" tracks, wouldn't it make sense to merge both railways and roads with close parallel lines into one thicker/higher priority one and that would solve this problem? --- **Location:** [z14 / 52.43021 / 21.42863](https://experiments.blahonga.org/#13.81/52.43021/21.42863) **Area:** circle r=1268 m @ 52.31349, 21.15892 ```map-report { "features": [ { "geometry": { "type": "Polygon", "coordinates": [ [ [ 21.177549805571644, 52.31348884188793 ], [ 21.17746008112946, 52.31460538422692 ], [ 21.177191771898332, 52.31571117365282 ], [ 21.176747461842837, 52.31679556080898 ], [ 21.176131429911685, 52.31784810245429 ], [ 21.175349608829137, 52.31885866203733 ], [ 21.174409527959597, 52.31981750731689 ], [ 21.173320240795746, 52.32071540408877 ], [ 21.172092237768435, 52.32154370511622 ], [ 21.17073734521811, 52.322294433407535 ], [ 21.169268611500694, 52.322960359038895 ], [ 21.167700181324772, 52.323535068782434 ], [ 21.166047159530336, 52.32401302786916 ], [ 21.16432546562089, 52.324389633291766 ], [ 21.16255168044997, 52.324661258134185 ], [ 21.160742886538404, 52.32482528650068 ], [ 21.158916503560363, 52.32488013870843 ], [ 21.15709012058232, 52.32482528650068 ], [ 21.155281326670757, 52.324661258134185 ], [ 21.153507541499835, 52.324389633291766 ], [ 21.15178584759039, 52.32401302786916 ], [ 21.150132825795954, 52.323535068782434 ], [ 21.14856439562003, 52.322960359038895 ], [ 21.147095661902615, 52.322294433407535 ], [ 21.14574076935229, 52.32154370511622 ], [ 21.14451276632498, 52.32071540408877 ], [ 21.14342347916113, 52.31981750731689 ], [ 21.14248339829159, 52.31885866203733 ], [ 21.14170157720904, 52.31784810245429 ], [ 21.14108554527789, 52.31679556080898 ], [ 21.140641235222393, 52.31571117365282 ], [ 21.140372925991265, 52.31460538422692 ], [ 21.14028320154908, 52.31348884188793 ], [ 21.140372925991265, 52.31237229954894 ], [ 21.140641235222393, 52.31126651012304 ], [ 21.14108554527789, 52.310182122966886 ], [ 21.14170157720904, 52.30912958132157 ], [ 21.14248339829159, 52.308119021738534 ], [ 21.14342347916113, 52.30716017645897 ], [ 21.14451276632498, 52.30626227968709 ], [ 21.14574076935229, 52.30543397865964 ], [ 21.147095661902615, 52.30468325036833 ], [ 21.14856439562003, 52.30401732473697 ], [ 21.150132825795954, 52.30344261499343 ], [ 21.15178584759039, 52.302964655906706 ], [ 21.153507541499835, 52.3025880504841 ], [ 21.155281326670757, 52.30231642564168 ], [ 21.15709012058232, 52.30215239727518 ], [ 21.158916503560363, 52.30209754506743 ], [ 21.160742886538404, 52.30215239727518 ], [ 21.16255168044997, 52.30231642564168 ], [ 21.16432546562089, 52.3025880504841 ], [ 21.166047159530336, 52.302964655906706 ], [ 21.167700181324772, 52.30344261499343 ], [ 21.169268611500694, 52.30401732473697 ], [ 21.17073734521811, 52.30468325036833 ], [ 21.172092237768435, 52.30543397865964 ], [ 21.173320240795746, 52.30626227968709 ], [ 21.174409527959597, 52.30716017645897 ], [ 21.175349608829137, 52.308119021738534 ], [ 21.176131429911685, 52.30912958132157 ], [ 21.176747461842837, 52.310182122966886 ], [ 21.177191771898332, 52.31126651012304 ], [ 21.17746008112946, 52.31237229954894 ], [ 21.177549805571644, 52.31348884188793 ] ] ] }, "properties": { "_kind": "selection-circle", "_radius_m": 1268 }, "type": "Feature" } ], "properties": { "lat": 52.430206, "lng": 21.428629, "map": "is", "zoom": 13.81 }, "type": "FeatureCollection" } ```
Author
Collaborator

Location: z11 / 52.22458 / 21.03393
Area: circle r=1181 m @ 52.25280, 21.10094

{
 "features": [
  {
   "geometry": {
    "type": "Polygon",
    "coordinates": [
     [
      [
       21.118273203042918,
       52.25279715168665
      ],
      [
       21.118189738587695,
       52.25383721755932
      ],
      [
       21.11794014903036,
       52.25486726702908
      ],
      [
       21.117526838054786,
       52.25587738015645
      ],
      [
       21.11695378607161,
       52.256857828999834
      ],
      [
       21.116226511884687,
       52.257799171300896
      ],
      [
       21.115352019542012,
       52.258692341418694
      ],
      [
       21.11433873088289,
       52.25952873763673
      ],
      [
       21.113196404431022,
       52.26030030500221
      ],
      [
       21.111936041414605,
       52.260999612899624
      ],
      [
       21.11056977981847,
       52.26161992661163
      ],
      [
       21.10911077748866,
       52.26215527217809
      ],
      [
       21.107573085415186,
       52.26260049392855
      ],
      [
       21.1059715124133,
       52.26295130413417
      ],
      [
       21.104321482506524,
       52.263204324300894
      ],
      [
       21.102638886384856,
       52.26335711770621
      ],
      [
       21.100939928368746,
       52.26340821286608
      ],
      [
       21.099240970352636,
       52.26335711770621
      ],
      [
       21.097558374230967,
       52.263204324300894
      ],
      [
       21.09590834432419,
       52.26295130413417
      ],
      [
       21.094306771322305,
       52.26260049392855
      ],
      [
       21.092769079248832,
       52.26215527217809
      ],
      [
       21.091310076919022,
       52.26161992661163
      ],
      [
       21.089943815322886,
       52.260999612899624
      ],
      [
       21.08868345230647,
       52.26030030500221
      ],
      [
       21.087541125854603,
       52.25952873763673
      ],
      [
       21.08652783719548,
       52.258692341418694
      ],
      [
       21.085653344852805,
       52.257799171300896
      ],
      [
       21.084926070665883,
       52.256857828999834
      ],
      [
       21.084353018682705,
       52.25587738015645
      ],
      [
       21.08393970770713,
       52.25486726702908
      ],
      [
       21.083690118149796,
       52.25383721755932
      ],
      [
       21.083606653694574,
       52.25279715168665
      ],
      [
       21.083690118149796,
       52.25175708581398
      ],
      [
       21.08393970770713,
       52.25072703634422
      ],
      [
       21.084353018682705,
       52.24971692321685
      ],
      [
       21.084926070665883,
       52.248736474373466
      ],
      [
       21.085653344852805,
       52.247795132072405
      ],
      [
       21.08652783719548,
       52.246901961954606
      ],
      [
       21.087541125854603,
       52.24606556573657
      ],
      [
       21.08868345230647,
       52.24529399837109
      ],
      [
       21.089943815322886,
       52.244594690473676
      ],
      [
       21.091310076919022,
       52.24397437676167
      ],
      [
       21.092769079248832,
       52.24343903119521
      ],
      [
       21.094306771322305,
       52.24299380944475
      ],
      [
       21.09590834432419,
       52.24264299923913
      ],
      [
       21.097558374230967,
       52.24238997907241
      ],
      [
       21.099240970352636,
       52.24223718566709
      ],
      [
       21.100939928368746,
       52.24218609050722
      ],
      [
       21.102638886384856,
       52.24223718566709
      ],
      [
       21.104321482506524,
       52.24238997907241
      ],
      [
       21.1059715124133,
       52.24264299923913
      ],
      [
       21.107573085415186,
       52.24299380944475
      ],
      [
       21.10911077748866,
       52.24343903119521
      ],
      [
       21.11056977981847,
       52.24397437676167
      ],
      [
       21.111936041414605,
       52.244594690473676
      ],
      [
       21.113196404431022,
       52.24529399837109
      ],
      [
       21.11433873088289,
       52.24606556573657
      ],
      [
       21.115352019542012,
       52.246901961954606
      ],
      [
       21.116226511884687,
       52.247795132072405
      ],
      [
       21.11695378607161,
       52.248736474373466
      ],
      [
       21.117526838054786,
       52.24971692321685
      ],
      [
       21.11794014903036,
       52.25072703634422
      ],
      [
       21.118189738587695,
       52.25175708581398
      ],
      [
       21.118273203042918,
       52.25279715168665
      ]
     ]
    ]
   },
   "properties": {
    "_kind": "selection-circle",
    "_radius_m": 1181
   },
   "type": "Feature"
  }
 ],
 "properties": {
  "lat": 52.224577,
  "lng": 21.033935,
  "map": "is",
  "zoom": 11.23
 },
 "type": "FeatureCollection"
}
--- **Location:** [z11 / 52.22458 / 21.03393](https://experiments.blahonga.org/#11.23/52.2246/21.0339) **Area:** circle r=1181 m @ 52.25280, 21.10094 ```map-report { "features": [ { "geometry": { "type": "Polygon", "coordinates": [ [ [ 21.118273203042918, 52.25279715168665 ], [ 21.118189738587695, 52.25383721755932 ], [ 21.11794014903036, 52.25486726702908 ], [ 21.117526838054786, 52.25587738015645 ], [ 21.11695378607161, 52.256857828999834 ], [ 21.116226511884687, 52.257799171300896 ], [ 21.115352019542012, 52.258692341418694 ], [ 21.11433873088289, 52.25952873763673 ], [ 21.113196404431022, 52.26030030500221 ], [ 21.111936041414605, 52.260999612899624 ], [ 21.11056977981847, 52.26161992661163 ], [ 21.10911077748866, 52.26215527217809 ], [ 21.107573085415186, 52.26260049392855 ], [ 21.1059715124133, 52.26295130413417 ], [ 21.104321482506524, 52.263204324300894 ], [ 21.102638886384856, 52.26335711770621 ], [ 21.100939928368746, 52.26340821286608 ], [ 21.099240970352636, 52.26335711770621 ], [ 21.097558374230967, 52.263204324300894 ], [ 21.09590834432419, 52.26295130413417 ], [ 21.094306771322305, 52.26260049392855 ], [ 21.092769079248832, 52.26215527217809 ], [ 21.091310076919022, 52.26161992661163 ], [ 21.089943815322886, 52.260999612899624 ], [ 21.08868345230647, 52.26030030500221 ], [ 21.087541125854603, 52.25952873763673 ], [ 21.08652783719548, 52.258692341418694 ], [ 21.085653344852805, 52.257799171300896 ], [ 21.084926070665883, 52.256857828999834 ], [ 21.084353018682705, 52.25587738015645 ], [ 21.08393970770713, 52.25486726702908 ], [ 21.083690118149796, 52.25383721755932 ], [ 21.083606653694574, 52.25279715168665 ], [ 21.083690118149796, 52.25175708581398 ], [ 21.08393970770713, 52.25072703634422 ], [ 21.084353018682705, 52.24971692321685 ], [ 21.084926070665883, 52.248736474373466 ], [ 21.085653344852805, 52.247795132072405 ], [ 21.08652783719548, 52.246901961954606 ], [ 21.087541125854603, 52.24606556573657 ], [ 21.08868345230647, 52.24529399837109 ], [ 21.089943815322886, 52.244594690473676 ], [ 21.091310076919022, 52.24397437676167 ], [ 21.092769079248832, 52.24343903119521 ], [ 21.094306771322305, 52.24299380944475 ], [ 21.09590834432419, 52.24264299923913 ], [ 21.097558374230967, 52.24238997907241 ], [ 21.099240970352636, 52.24223718566709 ], [ 21.100939928368746, 52.24218609050722 ], [ 21.102638886384856, 52.24223718566709 ], [ 21.104321482506524, 52.24238997907241 ], [ 21.1059715124133, 52.24264299923913 ], [ 21.107573085415186, 52.24299380944475 ], [ 21.10911077748866, 52.24343903119521 ], [ 21.11056977981847, 52.24397437676167 ], [ 21.111936041414605, 52.244594690473676 ], [ 21.113196404431022, 52.24529399837109 ], [ 21.11433873088289, 52.24606556573657 ], [ 21.115352019542012, 52.246901961954606 ], [ 21.116226511884687, 52.247795132072405 ], [ 21.11695378607161, 52.248736474373466 ], [ 21.117526838054786, 52.24971692321685 ], [ 21.11794014903036, 52.25072703634422 ], [ 21.118189738587695, 52.25175708581398 ], [ 21.118273203042918, 52.25279715168665 ] ] ] }, "properties": { "_kind": "selection-circle", "_radius_m": 1181 }, "type": "Feature" } ], "properties": { "lat": 52.224577, "lng": 21.033935, "map": "is", "zoom": 11.23 }, "type": "FeatureCollection" } ```
Collaborator

Fixed on fix/rail-merge-and-pl-classification (commit e6abf49, not merged).

Your diagnosis found the right place, but the mechanism is different — and simpler.
The sections that vanish at z10 are not being lost because they are small parallel
tracks. They are being lost because they are misclassified. BDOT10k's FUNKCJATORU
was tested for %stacyjny% first, so tor szlakowy stacyjny — which is the running
line where it passes through a station
— was filed as siding, and z10 drops sidings.
Every main line therefore had a gap at every station.

That is exactly consistent with what you saw: stations are precisely where there are
more parallel tracks, so "sections disappear where there are more tracks" is the same
observation seen from the other side.

The data settles which reading is right. NUMERLINII, the PKP line number, is what
"this is a running line" looks like in the source:

FUNKCJATORU rows with a line number now
tor szlakowy 20 023 19 351 main
tor szlakowy stacyjny 11 749 11 478 main
tor zwykły 2 131 0 branch
tor zwykły stacyjny 36 966 91 siding
bocznica 56 100 25 siding

The word that classifies a track is szlakowy (running line), not stacyjny (in a
station), so szlakowy is now tested first and both its forms are main. This restores
5 213 km of running line and takes the average numbered PKP line from 6.16 pieces to
3.79
at z10 (3 901 → 2 783 nationally). Line 21 at the spot you reported goes from 7
fragments with 2 249 m missing to a single continuous 21.6 km piece.

Your parallel-merge idea is in as well, because it is right for a different reason.
It is not what was breaking the lines, but it is what stops a station throat or a
freight yard from being a solid blob of ink, and it is a large byte win — see #9, where
it does most of its work. Implemented as merge_lines + parallel_merge_pixels +
parallel_priority in importer/layer.go: a chain lying 95% inside a better-ranked
chain's n-pixel corridor is dropped, and "better-ranked" is the class ladder, so the
survivor is the highest class in the corridor — the "merge into one higher-priority
line" you described. It is deliberately generic and reusable for roads, which is
#10; the one thing to solve first is that ST_Collect gathers a group into a single
geometry, which is fine for rail but wants a spatial split for a country's road network.

Rendered checks at your location and at Warszawa z11 look right — yards read as legible
track rather than a blob, and the through routes are continuous.

Fixed on `fix/rail-merge-and-pl-classification` (commit e6abf49, not merged). **Your diagnosis found the right place, but the mechanism is different — and simpler.** The sections that vanish at z10 are not being lost because they are small parallel tracks. They are being lost because they are **misclassified**. BDOT10k's `FUNKCJATORU` was tested for `%stacyjny%` first, so `tor szlakowy stacyjny` — which is the *running line where it passes through a station* — was filed as `siding`, and z10 drops sidings. Every main line therefore had a gap at every station. That is exactly consistent with what you saw: stations are precisely where there are more parallel tracks, so "sections disappear where there are more tracks" is the same observation seen from the other side. The data settles which reading is right. `NUMERLINII`, the PKP line number, is what "this is a running line" looks like in the source: | `FUNKCJATORU` | rows | with a line number | now | |---|---:|---:|---| | `tor szlakowy` | 20 023 | 19 351 | `main` | | `tor szlakowy stacyjny` | 11 749 | 11 478 | `main` | | `tor zwykły` | 2 131 | 0 | `branch` | | `tor zwykły stacyjny` | 36 966 | 91 | `siding` | | `bocznica` | 56 100 | 25 | `siding` | The word that classifies a track is `szlakowy` (running line), not `stacyjny` (in a station), so `szlakowy` is now tested first and both its forms are `main`. This restores 5 213 km of running line and takes the average numbered PKP line from **6.16 pieces to 3.79** at z10 (3 901 → 2 783 nationally). **Line 21 at the spot you reported goes from 7 fragments with 2 249 m missing to a single continuous 21.6 km piece.** **Your parallel-merge idea is in as well, because it is right for a different reason.** It is not what was breaking the lines, but it is what stops a station throat or a freight yard from being a solid blob of ink, and it is a large byte win — see #9, where it does most of its work. Implemented as `merge_lines` + `parallel_merge_pixels` + `parallel_priority` in `importer/layer.go`: a chain lying 95% inside a better-ranked chain's n-pixel corridor is dropped, and "better-ranked" is the class ladder, so the survivor is the highest class in the corridor — the "merge into one higher-priority line" you described. It is deliberately generic and **reusable for roads**, which is #10; the one thing to solve first is that `ST_Collect` gathers a group into a single geometry, which is fine for rail but wants a spatial split for a country's road network. Rendered checks at your location and at Warszawa z11 look right — yards read as legible track rather than a blob, and the through routes are continuous.
Collaborator

Merged to main as e6abf49 and pushed. Closing.

Merged to `main` as e6abf49 and pushed. Closing.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
art/ismap#3
No description provided.