OpenStreetMap logo OpenStreetMap

Enabling other mappers to add/update public transport routes in Belgium

Posted by Polyglot on 17 January 2015 in English. Last updated on 26 January 2015.

Today I put template route relations for itineraries of De Lijn and TEC on Dropbox. Generating them takes 2 hours. And then another 2 hours when I noticed Python hadn’t actually compressed them. I’ll update them as fresh data from De Lijn and TEC comes in.

I also worked on a script which you can run after opening such a file in OSM.

I put some videos on Youtube to illustrate the process

(no sound was recorded and I still have to add subtitles to them, some day)

The script will download all the stops. They are not included in the files. Once the stops are downloaded the view zooms to their extent.

Then the script will use an Overpass Query to download all route relations with the same ref as identifier. At the moment all over Flanders. I hope I’ll find a way to limit it to the bbox you just zoomed to.

For all the nodes on the way, Overpass will download all the nodes which are within 30 meters (and all the ways and relations they belong to).

Now you’ll have to run the compare script again. I didn’t figure out yet, how to make the script wait until the download completes, so it’ll give an error message saying it didn’t find the master_routes it was looking for.

When run again, after the download is complete with not objects selected, it’ll compare the template routes with the already existing routes. It uses the master_route relations to match them. If the existing routes don’t belong to a master_route yet, you’ll have to use the template and add the matching existing routes manually. You can leave the template routes, they’ll be removed from the master as we progress. Select all the existing and the template routes and close the master route. Now run the compare script again.

You’ll end up with a relation which has some funny looking roles. Each letter-number (a0w1i3) combination represents as stop. Now it becomes easier to see which template belongs to which existing route.

Select 2 routes which belong together and press the button to select them in the general window.

Move the window with all the routes out of the way.

Use the other script, which will add ways to the route. At first this script only added the ways adjacent to the stops. At some point I was thinking: why not try to look at the other route relations. Buses tend to all use the same itineraries to get from one stop to the next.

In the mean time the script also copies tags and stops from the template to the existing route relation and it odbl=new. This has the effect that it’s shown more prominently with help of MapCSS. Nothing to do with the license. That tag is only used, as it won’t ‘survive’ during upload.

Also the template routes came in tagged with odbl=tttttt. This is what the script uses to identify them as templates.

I’ll have to write some posts about how to set up JOSM to enable everybody to use those scripts, the MapCSS and add handy buttons for search and one click presets to the toolbar. One of these days…

Location: 3600, Winterslag, Genk, Hasselt, Limburg, Flanders, Belgium

Discussion

Log in to leave a comment