Type: | Package |
Title: | Google Encoded Polyline Algorithm Format |
Version: | 0.2.0 |
Description: | Encode and decode the Google Encoded Polyline Algorithm Format. See https://developers.google.com/maps/documentation/utilities/polylinealgorithm for more information. |
License: | GPL-3 |
Imports: | bitops |
Suggests: | tinytest |
URL: | https://github.com/riatelab/gepaf |
BugReports: | https://github.com/riatelab/gepaf/issues |
RoxygenNote: | 7.3.2 |
Encoding: | UTF-8 |
NeedsCompilation: | no |
Packaged: | 2024-10-16 14:07:37 UTC; tim |
Author: | Matthieu Viry |
Maintainer: | Timothée Giraud <timothee.giraud@cnrs.fr> |
Repository: | CRAN |
Date/Publication: | 2024-10-16 14:30:02 UTC |
Google Encoded Polyline Algorithm Format
Description
Encode and decode the Google Encoded Polyline Algorithm Format.
See the documentation here:
https://developers.google.com/maps/documentation/utilities/polylinealgorithm.
Note
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).
Author(s)
Maintainer: Timothée Giraud timothee.giraud@cnrs.fr (ORCID) [contributor]
Authors:
Matthieu Viry matthieu.viry@cnrs.fr (ORCID)
See Also
encodePolyline, decodePolyline.
Decode a Google Polyline to a Data Frame
Description
Decode a Google polyline to a data frame of coordinates.
Usage
decodePolyline(enc_polyline, factor = 5)
Arguments
enc_polyline |
a Google polyline. |
factor |
number of decimal digits to be used. |
Value
A data frame of latitudes and longitudes is returned.
Examples
coords <- decodePolyline(enc_polyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@")
coords
Encode Coordinates to Google Polylines
Description
Encode a data.frame of coordinates to a Google polyline.
Usage
encodePolyline(df_coords, factor = 5)
Arguments
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. |
Value
An encoded polyline is returned.
Examples
coords <- data.frame(
lat = c(38.5, 40.7, 43.252),
lon = c(-120.2, -120.95, -126.453)
)
encpoly <- encodePolyline(coords)
encpoly