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

Coordinates in encoded polyline are scaled by factor 10 #713

Closed
Earthwings opened this issue Aug 20, 2013 · 4 comments
Closed

Coordinates in encoded polyline are scaled by factor 10 #713

Earthwings opened this issue Aug 20, 2013 · 4 comments

Comments

@Earthwings
Copy link

Marble uses the json API to retrieve OSRM routes. This used to work fine, but lately the polyline decoding returns coordinates where each lat, lon pair is scaled by factor 10 each. The polyline decoding in Marble hasn't changed since I wrote it and it decodes strings from https://developers.google.com/maps/documentation/utilities/polylineutility fine. Am I missing some additional parameter that needs to be evaluated? Or is it some bug in OSRM maybe? I'd rather not go for dividing by ten in Marble without understanding what's going on.
There's a KDE bug report for it as well over at https://bugs.kde.org/show_bug.cgi?id=323772

@DennisOSRM
Copy link
Collaborator

We are providing coordinates with higher precision than google. The easiest fix is to change the 5 in this and the following line to a 6, i.e. divide by 1E6:

https://projects.kde.org/projects/kde/kdeedu/marble/repository/revisions/master/entry/src/plugins/runner/open-source-routing-machine/OSRMRunner.cpp#L153

@Earthwings
Copy link
Author

Thanks for the quick reply.
Maybe https://github.com/DennisOSRM/Project-OSRM/wiki/Server-api should give a hint about it?

@DennisOSRM
Copy link
Collaborator

Done, now it says "The geometry of the route is transferred in encoded form. See here for a definition of the format. The route geometry is compressed with a precision of six digits. See here for a proper JavaScript implementation."

@jose-nunez
Copy link

Here is another implementation. I fixed changing the division for 1e6 as you said. Thank you very much!
http://jeromejaglale.com/doc/javascript/google_static_maps_polyline_encoding

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

No branches or pull requests

3 participants