OpenStreetMap

Routing — Bearing Constraints for Departure and Arrival

Posted by daniel-j-h on 4 April 2017 in English (English)

The Open Source Routing Machine supports bearing constraints for quite a while now. In the following I want to highlight their use-cases and effects on routing.

Suppose you are driving north and make a routing request. An instruction to take a U-turn — since the routing engine does not know your heading — would be undesirable. This is the primary use-case for setting bearing constraints.

Setting a constraint of `bearings=0,90` tells the routing engine you are heading north and you want to allow for a variation of +-90 degree around true north. The format is `value, range` with

• `value` in `0, 360` degree for the direction; 0 degree represents true north, 90 represents east and so on
• `range` in `0, 180` degree for the allowed variation around the `value`; a variation of 90 degree allows for +- 90 degree

The `bearings=0,90` constraint therefore allows the route to start off towards north +- 90 degree. But not in the opposite direction you are currently heading. Sweet!

Another interesting use-case I came across at FOSSGIS is fire truck routing where your vehicles have to arrive at the right side of the street. Using bearing constraints not only for the route’s start but its end location we can let the routing engine generate optimal routes which guide vehicles to the right side of the street.

Here are two routes from a fire department in Berlin to an arbitrarily chosen location:

• In orange with a bearing constraint of `0,90` guiding the fire trucks to the location from the northern direction (raw request)
• In green with a bearing constraint of `180,90` guiding the fire trucks to the location from the southern direction (raw request)

Of course the use-case for end location bearing constraints is not limited to fire truck routing. The same applies to logistics use-cases or optimizing routes based on the probability of finding parking spots.

In short: providing a start location bearing constraint makes users happy. For advanced use-cases in addition set end location bearing constraints.

Check out the documentation for our beloved Open Source Routing Machine.

Comment from gileri on 4 April 2017 at 19:22

Neat writeup !