Skip to content
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

Different rounding in coordinate transformations in osmium wrt to osrm #3368

Open
oxidase opened this issue Nov 27, 2016 · 2 comments
Open
Milestone

Comments

@oxidase
Copy link
Contributor

oxidase commented Nov 27, 2016

Some tests expectation are ad hoc and have significant differences if input data is slightly translated, for example

    Scenario: Car - Check roundoff errors
        Then routability should be

            | highway | maxspeed | forw    | backw   |
            | primary |          | 52 km/h | 52 km/h |
            | primary | 60       | 47 km/h | 47 km/h  |
            | primary | 60       | 47 km/h | 47 km/h  |

fails in last row. The difference is due to rounding up in osmium at https://github.com/Project-OSRM/osrm-backend/blob/master/third_party/libosmium/include/osmium/osm/location.hpp#L183
but osrm uses truncated coordinates at https://github.com/Project-OSRM/osrm-backend/blob/master/include/util/coordinate.hpp#L77.

In the above test

OSM/request osmium reads osmium rounds to node lon phantom input
1.926039974358575 192603997 19260400 19260400 1926039

so for phantom input 1926039 weight is 1499 and speed is 3.61999.8/149.9=48.0272181454 -> 48,
but for phantom input 1926040 weight is 1500 and speed is 3.6
1999.8/150=47.9952 -> 47
so initial relative error of 2e-7 propagates to 1/48 in the result speed.

Related issue #3354

@TheMarex
Copy link
Member

Good find. We should probably use std::round here.

@TheMarex
Copy link
Member

To fully fix these incompatibilities we need to switch from 1e6 to 1e7 coordinate precision. Since we expose the Coordinate objects to our users, that could be a breaking change, hence the 6.0 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants