Search code examples
google-mapsgoogle-polylinealtitude

How to store altitude into Google Encoded Polyline Algorithm Format


I am now working on creating route paths from multiple markers on Google Map by using the Encoded Polyline Algorithm Format where it encodes all the information of latitudes and longitudes into an encoded string.

For example, here are the points ( longitude, latitude );

Points: (38.5, -120.2), (40.7, -120.95), (43.252, -126.453)

will become

Encoded polyline: _p~iF~ps|U_ulLnnqC_mqNvxq`@

So my question is, are there any way I can insert additional data, for example ALTITUDE, inside the google polyline algorithm? Like points ( longitude, latitude, atitude, ...)? Any other suggestions are welcome.


Solution

  • No you can't. Encoded polylines/polygons compress the latitude and longitude information into a more compact form, no additional information can be added.