Package 'gepaf'

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] , Timothée Giraud [ctb, cre]
Maintainer: Timothée Giraud <[email protected]>
License: GPL-3
Version: 0.2.0
Built: 2024-11-15 06:07:18 UTC
Source: https://github.com/riatelab/gepaf

Help Index


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

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 [email protected] (ORCID) [contributor]

Authors:

See Also

encodePolyline, decodePolyline.