| Title: | Google Encoded Polyline Algorithm Format |
|---|---|
| Description: | Encode and decode the Google Encoded Polyline Algorithm Format. See <https://developers.google.com/maps/documentation/utilities/polylinealgorithm> for more information. |
| Authors: | Matthieu Viry [aut] (ORCID: <https://orcid.org/0000-0002-0693-8556>), Timothée Giraud [ctb, cre] (ORCID: <https://orcid.org/0000-0002-1932-3323>) |
| Maintainer: | Timothée Giraud <[email protected]> |
| License: | GPL-3 |
| Version: | 0.2.0 |
| Built: | 2026-05-12 05:53:52 UTC |
| Source: | https://github.com/riatelab/gepaf |
Decode a Google polyline to a data frame of coordinates.
decodePolyline(enc_polyline, factor = 5)decodePolyline(enc_polyline, factor = 5)
enc_polyline |
a Google polyline. |
factor |
number of decimal digits to be used. |
A data frame of latitudes and longitudes is returned.
coords <- decodePolyline(enc_polyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@") coordscoords <- decodePolyline(enc_polyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@") coords
Encode a data.frame of coordinates to a Google polyline.
encodePolyline(df_coords, factor = 5)encodePolyline(df_coords, factor = 5)
df_coords |
a data frame of coordinates with two columns: latitudes and longitudes. Coordinates must be in decimal degrees (WGS84). |
factor |
number of decimal digits to be used. |
An encoded polyline is returned.
coords <- data.frame( lat = c(38.5, 40.7, 43.252), lon = c(-120.2, -120.95, -126.453) ) encpoly <- encodePolyline(coords) encpolycoords <- data.frame( lat = c(38.5, 40.7, 43.252), lon = c(-120.2, -120.95, -126.453) ) encpoly <- encodePolyline(coords) encpoly
Encode and decode the Google Encoded Polyline Algorithm Format.
See the documentation here:
https://developers.google.com/maps/documentation/utilities/polylinealgorithm.
Mostly a translation of https://github.com/mthh/polyline_ggl/ (itself a modest translation (i.g no GeoJSON wrapper, etc.) of other well known available implementations such as Node.js Mapbox one).
Maintainer: Timothée Giraud [email protected] (ORCID) [contributor]
Authors:
Matthieu Viry [email protected] (ORCID)
encodePolyline, decodePolyline.