-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Difference in distance when using route and table #5151
Comments
I know that sometimes, when two routes have the same duration, it is possible that We decided to not to bother too much because in our experience the distances did not differ much. Unpacking all possible routes would probably affect performance even more. I am currently still searching for the bit of code where we pick a random route to unpack because I don't quite remember anymore. I'll post it for more context if I can find it. |
Hi @chaupow , I did a second try with a pair for which an alternative route which has similar distance is unlikely and I still get a difference. |
In this case, I'd suspect a bug in the distance unpacking for the |
Yea. That route looks pretty umambiguous 🤔 Another thing is that we have a mixed usage of @rgugliel are the distance differences you see big? |
Also, @rgugliel are you using CH or MLD algorithm? (= do you use |
@chaupow No, usually it is pretty small, typically around 0.1 - 0.2% I use CH. |
I have also seen these differences. I filed issue #5106 when I noticed the distances could actually be returned as negative values. I suspect they are related somehow, but cannot be certain. |
@barqshasbite Thanks for the update. I'll redo my test when 5.18.1 will be there, then! |
A colleague did a test using master and it seems that the fix of #5060 decrease some of the discrepencies but not completely. |
I get the same result (as in the initial post) with osrm-backend 5.20.0 Any idea? |
Hi there, |
Using (SouthAmerica Map), in a localost, checking these 3 points:
All waypoints (for Route), sources and destinations (for Table) returned had exactly the same data. Diferences in distance and duration: Route vs Table :
|
You should add |
Perfectly, I missed that:
|
Yeah, I'd say those small differences can probably be entirely explained by the inconsistent use of different length calculation algorithms across the OSRM codebase. For example, the using a weird combination of Great Circle distance, and the fast FCC approximation method. The the It's a bit of an inconsistent mess. It's come about because over time, we've done incremental performance improvements in critical loops. IIRC, we avoided touching all of the codebase because a) changing lengths would've invalidated many of the carefully constructed tests, and b) the error sizes were quite small - well below the precision of the map data we're operating with. e.g. in the real world, can you prove whether I definitely agree we should be consistent internally, but it's a bit of work to clean up. |
Hi! I have another issue related to this: The first(default) route from Routes Api is not the one picked by Table Api. Computing alternatives I see that the second route is the one Table is returning/computing. Why is this happening and can it be fixed? |
@gabriel-munteanu that is a very interesting case, thank you for the example. This highlights one of the underlying issues pretty clearly - graph exploration order. The The many-to-many (table) algorithm and the routing algorithm (route) are different. I'm not sure if it'd be possible to write them to guarantee they discover paths in the same order, they have some deep differences that might make that pretty hard. Ultimately, when there are multiple equal cost paths from point A to point B, you can't even say which algorithm is right. If you do have an opinion on which is right and which is wrong (e.g. take the shorter route when durations are equal), then that idea needs to get codified in your edge cost. |
I've been thinking about whether
Can we have the documentation somehow updated to reflect that |
@ilibar-zpt the |
Had to re-read the description of |
Yeah - if you place a coordinate on a street with a dead-end, then the routing algorithm will explore both directions from the point, but the dead-end path with a u-turn will never be the best, because it ends up turning around and passing the origin point again. The only caveat to that is if you force the departure/arrival direction with |
UPD: so it seems like that distance is a deviation of snapped position to original position http://project-osrm.org/docs/v5.5.1/api/#waypoint-object I got into the same situation, but I wonder when we do table query, what "distance" property is about in waypoint object? for example, table result for A -> B {
"code": "Ok",
"destinations": [
{
"hint": "*******",
"distance": 16.746585939,
"name": "", // it is empty, idk why
"location": [ *******, ******* ]
}
],
"durations": [
[
16344.5
]
],
"sources": [
{
"hint": "******",
"distance": 109.827896886,
"name": "B",
"location": [ *******, ******* ]
}
]
} and route result for the same A -> B {
"code": "Ok",
"routes": [
{
"geometry": "*****",
"legs": [
{
"steps": [],
"summary": "",
"weight": 16377.1,
"duration": 16344.5,
"distance": 340854.4
}
],
"weight_name": "routability",
"weight": 16377.1,
"duration": 16344.5,
"distance": 340854.4
}
],
"waypoints": [
{
"hint": "**********",
"distance": 109.827896886,
"name": "B",
"location": [ ********, ******** ]
},
{
"hint": "****************",
"distance": 16.746585939,
"name": "",
"location": [ ********, ******** ]
}
]
} |
Hi,
I'm playing a bit with the table service and the distance it can now return (thanks for that, it is awesome!).
I noticed that there exists pairs of coordinates that are such that the distance returned by the table service is different that the one returned by the route service although the durations are the same.
As an example, I took the Lyon map (http://download.bbbike.org/osm/bbbike/Lyon/), and ran the following two queries on a local instance:
What I get are the following two:
The two durations are the same, 237.6 but the distances differ. I found other examples on other maps, too.
Is that normal?
Thanks a lot.
The text was updated successfully, but these errors were encountered: