Bicycle routing avoiding road works

Posted on July 16, 2019 in Dev • 2 min read

Many cities (and administrative areas) in France are providing OpenData feeds concerning ongoing road works. All are not as detailed or as precise, but they all provide the information about potential traffic disruption in this area.

When you ride a bicycle, most road work may actually affect your route, either directly (bicycle lane closed without any deviation) or indirectly (road works usually means a lot of traffic jam, and it may be tricky even with a bicycle). Can we have a router avoiding road works?

BRouter is a very nice, efficient and customizable router (which can run either on your Android phone or with a web interface). It has a feature to exclude some areas from the routing algorithm (called “nogo areas”). These areas were initially circles but it was recently extended to support polylines and polygons exclusion areas.

Conversely, Brouter-web got recently extended to support the import of such nogo features from a GeoJSON file (such as the one provided by Paris city hall). By default, the importing nogo areas are totally excluded (as can be seen with the weight -1 set in the import modal).

Then, one can compute a route, and these road works area will be excluded from the calculation, leading to longer (but safer!) routes!

Here is an example, where the typical route (best compromise) would normally be given by the first image. It takes the “Rue Didot”, which sadly is affected by road works. When taking them into account (pink areas on the second image), a detour is proposed, along the rails, resulting in a longer but safer route (full exclusion of road works is used here).

When not taking into account road works, the best route uses Rue
        Didot. Due to road works, Rue Didot is no longer usable. An alternative
        route is computed.

To refine the route further, one can filter the OpenData GeoJSON file on the starting date or impact of the road works, to only include the road works affecting the highway and currently going on. I recently added to BRouter support for not only full exclusion areas but penalty areas.

Changing the - 1 cost (full exclusion) to a positive cost value, the area can be crossed but with a penalty given by the cost times the distance travelled across the area. This way, one might try to avoid a square with road works, while still considering it in case the alternative route is too long.

Providing your city has an OpenData feed for road works, routing and taking them into account is now possible!