The goal of gepaf is to encode and decode the Google Encoded Polyline Algorithm Format.
Encoding
library(gepaf)
<- data.frame(
coords lat = c(38.5, 40.7, 43.252),
lon = c(-120.2, -120.95, -126.453)
)<- encodePolyline(coords)
encpoly
encpoly#> [1] "_p~iF~ps|U_ulLnnqC_mqNvxq`@"
Decoding
<- decodePolyline(enc_polyline = "_p~iF~ps|U_ulLnnqC_mqNvxq`@")
coords
coords#> lat lon
#> 1 38.500 -120.200
#> 2 40.700 -120.950
#> 3 43.252 -126.453
Mostly a translation of https://github.com/mthh/polyline_ggl/ (itself a modest translation of other well known available implementations such as Node.js Mapbox one)