openrouteservice
openrouteservice copied to clipboard
Directions seems to produce wrong results
Here's what I did
I tried several routes using the client map, the directions API and the Optimization API and it seems that in several cases we have a strange output. Even if there is a direct straightforward main road connecting 2 points, the suggested route leaves the main road and follows another path with turns into smaller roads. An example is this link
Look at also this
Here's what I got
Here's what I was expecting
I was expecting a straightforward route across the main road.
Here's what I think could be improved
I reformatted your comment for better readability.
Thank you for reaching out!
The unexpected route is a consequence of how ORS estimates average travel speed on streets. The default speed value corresponding to road type (OSM highway tag) is modified based on the way's length in order to take into account acceleration and deceleration phases. This heuristic tries to model regular traffic flow, however, it has the downside of underestimating the speed if a given street is split into several shorter segments. This is exactly what happens in the provided example where the main street is divided into multiple separate OSM ways. The following table provides details on the OSM ways involved with their default speeds based on highway type, internal adjusted speed values and the actual speeds stored and used for routing. As evident from these values, the estimated travel speed on the main road is considerably lower than on the parallel side street, so to the algorithm it appears to be faster to take the latter.
There have already been similar issues reported in the past such as https://github.com/GIScience/openrouteservice/issues/673. We are investigating alternatives to the current heuristic in order to improve the routes, see https://github.com/GIScience/openrouteservice/issues/630. Let's keep this issue open until a workaround is found.
OSM Way ID | Highway Tag | Default Speed | Adjusted Speed | Stored Speed |
---|---|---|---|---|
929551786 | residential | 30 | 30.0 | 30 |
32118641 | tertiary | 50 | 47.7 | 50 |
107571437 | tertiary | 50 | 22.2 | 20 |
929551785 | secondary | 60 | 20.1 | 20 |
929551790 | secondary | 60 | 15.6 | 15 |
929551791 | secondary | 60 | 23.9 | 25 |
684511102 | secondary | 60 | 26.3 | 25 |
929551784 | secondary | 60 | 10.2 | 10 |
684511104 | secondary | 60 | 15.7 | 15 |
929551789 | secondary | 60 | 13.7 | 15 |