How to decode a polyline string


When I use the openroute service, there is a geometry polyline string as an answer to some requests (e.g. the Optimization request when adding the {“g”:“true”} option). My question is how I can decode such a polyline to get the coordinates of all the points which consist it. Also, what is the algorithm to encode a set of points to a polyline string (the opposite process)?

Thank you.


this is using the encoded polyline algorithm. There is a web-based decoding and encoding tool, and many programming languages support de-and encoding polylines:
The android sdk for gmaps, the javascript library for gmaps, python polyline, java encoded polyline and many more - searching for encoded polyline and your language should give you a bunch of results.

Best regards