Mapping public transport routes on OpenStreetMap can be a challenge, keeping them correct and up-to-date even more so. Last year I mentored the Mapillary plugin for GSoC. Before that, I had been working on public transport a lot, and to add the stops precisely where the poles are, horizontal imagery is a big help, when it’s available. The idea to propose a GSoC project for public transport this year was a logical consequence of some Python scripting I had started on. It’s possible to run Python in JOSM, but it involves too much setup for it to be practical for general use by other mappers.
Still, automation is key. Without it, it’s next to impossible to even find all the problems with the route relations, let alone fix them.
Also the way we’re mapping public transport, at the moment (who knows one day route segments become the thing), is very repetitive and fixing all those routes for all variations of the lines gets tedious fast. This in turn results in very few people interested in doing it. And the ones that do burn out sooner or later.
I’m sure the new plugin will be a big help to solve that problem.
At the moment the plugin is very good at detecting problems with the routes:
- going against oneway traffic
- gaps that are caused by wrongly ordered ways (automatic fix available)
- routes that don’t start/end on a stop_position node
- ways that still need to be split on those terminal nodes
- buses or trams that travel over ways unsuitable for that mode of transport
The latest addition is a dedicated extra layer. This layer highlights the route for which a relation editor window is open. You can have several relation editor windows open, but only the last one that had focus, will be shown highlighted. One thing that I was never able to achieve with plain MapCSS is to show sequence numbers for the stops and the platforms. The other was showing the refs of all the route relations serving those stops. All that becomes trivial (compared to MapCSS) if one can code it in JAVA, and Darya is doing a great job there.
So, what’s next?
The initial idea was to be able to start from a route relation containing just stops in the correct order and have the code figure out which ways to add to the relations. That will still happen, but fixing existing route relations and helping all mappers to keep the route relations ‘coherent’, when they make changes to the underlying highway/railway infrastructure is a higher priority, so we started by integrating the plugin in the validator. Thus making it very accessible for anybody who installs the plugin. It’s amazing how many problems have already been able to solved - both in the routes and in the ways they followm, as in the platforms and stop_positions -during beta testing of the code.
Want to try it yourself?
You can easily install the PT_assistant plugin in JOSM and help with testing.
User documentation can be found here
What I usually do, is File / Download from Overpass API (expert mode needs to be on for it to show that option in the menu, don’t ask me why) Then use the following query:
[out:xml][timeout:125]; ( relation["public_transport:version"="2"]["route"="bus"]; ); (._;>;); out meta; You can select routes for other modes of transport, of course. After downloading, I make sure nothing is selected, then press the validate button. ![Screenshot of dialog](https://lh3.googleusercontent.com/yd6MMLxRUkks0BmnRSPXxnS-9XRip9POjcMrsjzM39U34PEMnKKUQRM0YVOf-dJ42T7IEVm1lW2wVHcOqZucc5cFvLbGY2gHUYKdo3OMlooT_K6eHmKsOyGJ2BBwbB38xDcATg_1Tng2McxYTuCis0WTEoTzIrTUw6i9Gzll_t27M0Gr8PoRFoIeVLIv7gfhGcJC3oIH29Wo8IVD-TzQGxCY1HAuW-FBnOKnIcQ45JPHZM4D-JmQjc_7JgGAyTq6EP5gSjtoiAExRYBm8rOZT6h-9VCMNj_Z_CH_MIuRxXxssAmJo52RyAQgFdM4IWhE_-roCUYMl5rHJlKKm3HVYZHGMLlSwRiNVnyJ8tGRg5AzcTVZpgu44v7tClFUutXk0hd2dIwFqAJHElic5IsoelxSkhmM6OUSUSWqdCVIXgVjXsDKopnIZpF5la5askVLaKaBm763lLQB01DTEnSrEvjEmbJHq5WSh8WeD_qkwuCdMrm-L4n-SrT1IVBYUYVXfWU-8VDkqEzIiYleO_Q_irSFq2dHGWTsfP1E8PguQ1Eky1hqbb3yp30Ghcq5KiMrMWZ8T7ABH9VStjsxnzXBlvS9BOLS2Z4=w872-h631-no) I usually use the last option, as I don't want all the fixes applied automatically for the time being. Implementing automatic fixes with user intervention where there is doubt, is in the pipeline. If you have the plugin installed, you'll find several categories that start with PT_ ![Screenshot of validator pane](https://lh3.googleusercontent.com/LmT6yLOVqyKLCkWdPsQyp5nW56UHcZJ6ineYwxjzFXeGyYRx-WKDH8wr1vzhJHycRP8Y8WA8qUqVS48y6rWjY5BlunavBAbhoqw3nYnds3YaZf96rxYsq9l_NYKPRptEfu75wJa6QeDgxlrdtjJmaBIefseVALiyKjq8OHr9nINee9u8D-4FMzLEl_gEd7vvxKnZQFiO_Sleo7IcQwu-ZBQEfrvTtWkTNVvJUcILvc8yRwksZK5A0vhwOY8YXNxtfKknLl-ctg7NUmHX1lxqrCN6wgh1zobCZMEcMlMyomjUtDIltFwLqisVnXo09PiPYnzU6FPD-lW0t4jHZ4SDnJ6enzsYY28wJG26HXNOK-B5CIZuXhEwUiZ-lhMozN7NVYgnrV8Kp2N8upWRaE-yJ7tLFp7stiqRA4Ni_Mn-OFBUyPGPkfotCo_HpBA_5n6kOsciw-T7_82OPXYGiaIh36fe8BrJW6YRD2qp-S0g9ir_rKcTcpC1KrjLE3PV8xN35dVoolCS-D8UlJMOQpXXrJmD8xlSb2Icg4WYNSgQ4lZ8N8GuCe_tTZpjyvtpIJP2O038fFGcx7E5p5PVVS9oK4daJdGRfI0=w620-h234-no)
The easiest ones to tackle are: * Route contains a gap that can be fixed by sorting
For those you can simply press the fix button. Don’t select more than, say 5, at a time.
If your stops where not at the beginning of the route, now they will be. The order should be preserved. If they don’t have roles, select all of them, make them selected in the editor window, remove them from the Relation Editor and readd them. Now go visit the ones that still don’t have roles and fix their tagging.
Now press the upload button, which will result in a new validation Usually you’ll find there are more problems to solve at this point. For the routes that have ways going against oneway traffic, pressing the fix button will result in removal of that way. It’s better to press right mouse button Zoom to problem, select the way(s) that have a yellow casing around them, then press right mouse button edit. The relation editor will open with those ways selected in blue. Now it’s possible to remove them, or to add oneway:bus=no, if that is the proper solution. If you remove them, you probably want to readd ways from the other side of the dual carriageway or roundabout. If you notice that there are several variations, which are likely to need the same fix, keep the ‘problem ways’ selected and open all of them in relation editor windows. After all are openedm select the ways to replace them with, and do this in each editor window.
Be careful not to split ways for which you have relation editor windows open. You'll get 'conflicted with yourself', which is something to avoid at all cost :-) Have a look in the comments to learn how to avoid conflicts while keeping RE windows opened.
All this may seem like it’s still a lot of manual work and you’re right, it is. The intention is to automate all this further. I’ll probably write a new diary entry in a few weeks about that.
If you’re interested in a hangout about the mapping of public transport and the use of the plugin, get in touch and we’ll set one up.