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

Not working encoded strings from Open Routing Machine #17

Closed
josephkandi opened this issue Apr 11, 2015 · 3 comments · Fixed by #18
Closed

Not working encoded strings from Open Routing Machine #17

josephkandi opened this issue Apr 11, 2015 · 3 comments · Fixed by #18

Comments

@josephkandi
Copy link

I tried this string

}gqefAridwgFrYEAhfA{@jDsAxBoBzBaDtB{iAX{c@EsU]uf@?_WR~@tPlTFfg@?jUNj|@eBtu@K?z]cAjLkDlJuFjGyG`IyCjIsAlM?|k@v@|dArQbv@k@jIpA?

and it didnt output the right coordinates. I did divide them by 10 and i got the right coordinates just before adding them to the CLLocationCoordinate2D array

@raphaelmor
Copy link
Owner

When I try the string with google's polyline decoder : https://developers.google.com/maps/documentation/utilities/polylineutility , it decodes to invalid GPS locations : (373.3211 , -1220.3076).

It seems OSRM uses a higher precision than google : Project-OSRM/osrm-backend#713

I might work on being able to change the precision factor, or I can accept a merge request doing so :)

raphaelmor added a commit that referenced this issue Apr 13, 2015
Added support for custom precision in Encoding/Decoding. Fixes #17
@raphaelmor
Copy link
Owner

@josephkandi you can use v1.1.0 to decode polylines from OSRM :

// OSRM uses a 6 digit precision
let polyline = Polyline(encodedPolyline: "ak{hRak{hR", precision: 1e6)
// or 
let coordinates: [CLLocationCoordinate2D]? = decodePolyline("ak{hRak{hR", precision: 1e6)

@josephkandi
Copy link
Author

Thanks

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

Successfully merging a pull request may close this issue.

2 participants