Fixing Routing with Map Roulette

Want to make OpenStreetMap even better? Try the MapRoulette One-Way Challenge!

Not so long ago the routing team noticed that the origin or destination of a route would occasionally be unreachable. After some investigation we realized that certain errors in OpenStreetMap could easily cause the routes to fail, especially when the direction of one-way roads was switched. To differentiate between routes that fail because two locations are disconnected in real life, and those that were doomed from the start by these wrong-way errors, we started trying to detect them.

To demonstrate the impact they can have, here is the same route before and after an error was fixed. The one-way road in the red box was reversed, forcing the route to go much farther than needed.

route error

As we started working on the code to look for these errors, we had to figure out what to do with them. Do we manually edit them all ourselves? Do we ignore them and hope they get fixed down the road? There could be hundreds or thousands of these types of errors in OSM that could impact routing.

Enter Map Roulette, a platform that allows contributors to submit sets of errors so that the OSM community can fix them. We planned to submit the errors we were collecting to Map Roulette, but as we progressed, we realized that it was not enough to eliminate just one set of errors we had collected. Users are adding data to OpenStreetMap all of the time, and we needed a way to tag any errors made in the future.

We also thought that we could automate the process to minimize manual intervention. To start testing this we needed the help of Martijn Van Exel, the creator of Map Roulette. He helped us get local instances of the Map Roulette server running as well as answering other questions we had along the way.

The automation process seemed like a good fit for a bit of Python. After building a few tools to test the Map Roulette API with our collection of errors, we brought it all together into a system that checks the latest set of tiles without any manual intervention and automatically uploads new errors to Map Roulette. (Additionally, the tool can also detect previous errors that were incorrectly marked as fixed in Map Roulette.)

maproulette

The result of all this work is a general framework that allows for detection, submission, and eventual resolution of any kind of OSM errors. To start doing this for a new type of error, the only thing we would need to do would be to write a detection algorithm, create a GeoJSON representation of it, and add it to the tool’s configuration file.

Currently, we only have one type of error that is being detected and automatically submitted, but look forward to seeing what other issues we can fix and how much we can help improve OSM. You can jump in and fix these wrong-way errors right now in Map Roulette!