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
0, 360degree for the direction; 0 degree represents true north, 90 represents east and so on
0, 180degree for the allowed variation around the
value; a variation of 90 degree allows for +- 90 degree
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,90guiding the fire trucks to the location from the northern direction (raw request)
- In green with a bearing constraint of
180,90guiding 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.