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. 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_
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.