Description Usage Arguments Value Examples
decode_geom() uses a decoding algorithm to decode polylines. (http://stackoverflow.com/questions/32476218/how- to-decode-encoded-polylines-from-osrm-and-plotting-route-geometry)
1 | decode_geom(encoded, precision = stop("a numeric, either 5 or 6"))
|
encoded |
A character containing encoded polylines |
precision |
A numeric (either 5 or 6) to specify the precision of [lat,lng] encoding. (OSRM API v4 used precision 5 with "polyline", OSRM API v5 uses precision 6 with "polyline6") |
data.frame with lat and lng
1 2 3 4 5 6 7 8 9 10 11 12 13 | decoded_api_4 <- decode_geom(osrmr::encoded_string_api_4, precision = 5)
decoded_api_5 <- decode_geom(osrmr::encoded_string_api_5, precision = 6)
decoded_api_4[1:3,]
# lat lng
# 1 47.10020 8.09970
# 2 47.09850 8.09207
# 3 47.09617 8.09118
decoded_api_5[1:3,]
# lat lng
# 1 47.10020 8.099703
# 2 47.09850 8.092074
# 3 47.09617 8.091181
assertthat::assert_that(all.equal(decoded_api_4, decoded_api_5, tolerance = 1e-6))
|
lat lng
1 47.10020 8.09970
2 47.09850 8.09207
3 47.09617 8.09118
lat lng
1 47.10020 8.099703
2 47.09850 8.092074
3 47.09617 8.091181
[1] TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.