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

Truncate precision in CLLocationCoordinate2D to relevant decimal places #309

Closed
JThramer opened this issue Nov 9, 2018 · 3 comments
Closed
Assignees
Labels

Comments

@JThramer
Copy link
Contributor

JThramer commented Nov 9, 2018

When crafting a custom RouteOptions request , the user has the ability to use the full Double bitwidth to describe CLLocationCoordinate2D waypoints. This causes us to potentially emit really long requests when we end up requesting a route.

We only pay attention to the the fifth or sixth decimal place in the API (depending on the API version I think? cc @1ec5), so we should truncate our values to match at request time.

/cc @mapbox/navigation-ios

@JThramer JThramer added the bug label Nov 9, 2018
@1ec5
Copy link
Contributor

1ec5 commented Nov 10, 2018

We only pay attention to the the fifth or sixth decimal place in the API (depending on the API version I think?)

OSRM uses up to six digits of precision. That has been the case since at least OSRM v0.3.8, which came before Directions API v4, the first version of the API that this library supported.

@1ec5
Copy link
Contributor

1ec5 commented Nov 10, 2018

@JThramer JThramer self-assigned this Nov 13, 2018
@1ec5
Copy link
Contributor

1ec5 commented Nov 14, 2018

For reference, MapboxGeocoder.swift uses a format string to truncate (not round) to five digits of precision:

https://github.com/mapbox/MapboxGeocoder.swift/blob/c5fcfe127b0b2c07b7bd9d5006f7f4fe0dc04b27/MapboxGeocoder/MBGeocodeOptions.swift#L185

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

No branches or pull requests

2 participants