Skip to content
DennisOSRM edited this page Dec 19, 2014 · 4 revisions

How to debug routing errors

Problems with routing in general fall into one of two categories:

  1. Problems with the data

  2. Problems with the routing algorithm

Speaking from experience, the second case is extremely less likely. So you always want to start with examining the data. This guide is not 100% comprehensive, but should cover most of the common cases.

How a bug report should look like

It should provide a link to the offending route (that is a link to the OSRM demo site) and a short description of the expected result.

Symptoms

No route found

The routing engine does not find a path from the start point to the end point. On the demo site this typically looks like a map with just two markers but no route in between.

Cause of such errors can be:

  1. Connectivity problems

  2. No street-segments are near either end of the route (e.g. if you place it in the middle of Siberia that might happen)

(2.) is expected behavior.

Route takes an unusual detour

Varies in the severity:

  1. Obviously inefficient routing, instead of taking a straight 10 meter segment the routing takes 2km detour.

  2. The route looks plausible, but is longer than expected.

Causes:

  1. Connectivity problems

  2. The measurement of "how good is a route" differs from the user as to what is specified in the profile. For example, some profiles might add very high penalties for crossing toll booths. The resulting route will typically take detours. So it will not be the fastest route, but optimal in a sense that is less obvious to the user.

(2.) is more likely when the route looks plausible but sub-optimal.

Route is a lot shorter than expected

Causes:

  1. There should be a barrier in the OSM data, but it is actually not there.

  2. There is a barrier in the data, but the profile OSRM uses does not consider it.

Routing time is higher than expected

The estimations we do on routing time are rather rough. For good estimations you need real traffic data, which is not part of OSM. This is something that highly depends on the profile you use with OSRM. For car speeds we usually use 85% of the tagged maximum speed and fall back to maximum speeds based on the highway class if there is no tag.

Causes

Connectivity problems

Crucial for this kind of problems is to locate the exact location where the breakage occurs. Just try to move one of the markers back until it finds a route again. Confirm by placing a marker shortly before and after that point.

Once the location is verified, you can open the concerting section of the map in iD or JOSM directly from the view on the demo site:

Impasse

One of the starting points is in an "impasse". Examples for this are for example one-way streets that don't have an exit, or roads on parking lots that are not connected to the street.

How to resolve: Figure out exactly where the impasse starts. Check if it is actually meant to be that way. Open it in iD or JOSM and fix it.

Barrier nodes

There is a barrier node in path. This highly depends on what is considered a inaccessible in the profile. For examples stairs are fine for the foot profile but a problem in the car profile.

How to resolve: Is that barrier node actually correct? Does it make sense to consider this kind of barrier in the context of the profile? If the data is incorrect, change that in OSM. If you think the profile is incorrect, open an issue and propose a change.

Missing connection between street segments

Sometimes a way looks connected on the map, but actually the end points are not connected. The routing engine can not know whether they are supposed to be connected or not, even if they are placed perfectly on top of each other.

How to resolve: Open it in iD or JOSM and connect the concerning street segments.

Using the small components layer

During each data update, the network is analyzed for badly reachable portions. There's a tile layer available that visualizes identified issues on z14+: http://tools.geofabrik.de/osmi/tiles/routing_i/{z}/{x}/{y}.png

The layer can also be shown through the OSRM demo UI.

Clone this wiki locally