Quantcast
Channel: maps for developers - Medium
Viewing all articles
Browse latest Browse all 2230

Better (re)routing with accurate turn bearings

$
0
0

When it comes to building turn-by-turn navigation, getting the rerouting interaction right is critical to user experience but it’s also challenging due to noisy GPS. Missing a turn can mean you’re driving blind, at the same time over-sensitive reroutes are confusing and distracting.

One factor involved in rerouting that I’ve been working on is deriving highly accurate turn bearing data from OpenStreetMap, the largest open geospatial project and a source of data for our Directions API.

OpenStreetMap’s ground truth observations are an incredibly valuable source of information, but deriving bearings from that data can be tricky. Slight differences in the way streets are modeled by OpenStreetMap contributors can throw off how bearings are calculated.

You can see an example of this in how broad roads are modeled in OpenStreetMap:

fork-edit

In OpenStreetMap, it looks like two roads are merging when this is, in fact, two highways intersected by a median.

Thanks to improvements in the Open Source Routing Machine (OSRM) 5.5 release, the Directions API now exposes highly accurate bearings for each turn in an intersection.

{"intersections":[{"bearings":[10,92,184,270],"out":2,"in":3,"entry":["true","true","true","false"],"location":[13.39677,52.54366]}]}

For more information on intersections, visit the api-documentation.

How OSRM sees and calculates bearings:

Bearings for off-route detection

The navigation engine needs to know the expected bearing a user will take in order to detect when users go off-route. If the navigation engine expects the user to take a bearing of 110 degrees but detects 130 degrees instead, it would indicate that the user has left the chosen route.

For successful off-route detection, the system needs to have all available turns at any intersection and their directions or bearings. The quality of off-route detection, and therefore the quality of the navigation experience, correlates strongly with the extent to which we can provide a correct bearing.

Road modeling and bearing estimates

Despite huge efforts in quality control and validation through the global community, the conventions in OpenStreetMap for modeling bearings differ from what off-route detection requires. The guidelines state that a way should be located in the middle of the road. When the number of lanes changes, we introduce artificial bearings into the way.

If the bearings don’t match the actual roads, the user experience will suffer from unnecessary reroutes or delayed reaction time. When the location of a turn is reached and the bearing shortly after does not match what we expect, it is likely that the car has gone off-route.

turn-angle-1

The satellite image above shows how a highway ramp clearly takes a slight turn to the right. However, the same ramp in OpenStreetMap shows a rather steep turn to the right for the first few meters when the road takes a turn to the left.

To address this inconsistency, OSRM estimates bearings by skipping over the first few meters of the turn and looking at the angle of the road segment just after.

A turn on a curve

On curves, you cannot only look ahead as the bearing gets steeper with every meter along the road. The computation of bearings is a delicate balance between looking far ahead or close by. The navigation engine needs to decide whether the bearing at the intersection is best described by coordinates close to the turn, or by coordinates further down the road in case of offsets due to road widths.

In the image we see here, the bearing close to the turn is preferable over the bearing given when looking down the road. For this reason, OSRM does not only look ahead in all scenarios but detects different settings like curves and offsets, and chooses the best lookahead accordingly.

A delicate balance

To provide the best possible bearings for all intersections in OpenStreetMap, we have to find out when to look ahead. The latest OSRM release identifies offsets due to lanes, curves, and slight disturbance in coordinates. Future releases will continue to add detection for more scenarios that influence the bearings and handle them accordingly.


Viewing all articles
Browse latest Browse all 2230

Trending Articles