Skip to content

jonocarroll/googleway

Repository files navigation

googleway

CRAN Release CRAN_Status_Badge CRAN RStudio mirror downloads Github Stars

Development Version

Build Status Coverage Status

Functions to retrieve routes from Google Maps Directions API, and to decode the polylines received from the API call.

There are significnat changes coming in the next release. See News for latest updates and details on the development version.

get_route() retrieves route information from Google Maps.

decode_pl() decodes polyilnes that are generated from the API call.

Examples

get_route

## return data.frame of route
df <- get_route(origin = "Flinders Street Station, Melbourne",
                destination = "MCG, Melbourne",
                mode = "driving",
                key = "<valid_api_key>",
                output_format = "data.frame")
                
## return JSON of route
js <- get_route(origin = "Flinders Street Station, Melbourne",
                destination = "MCG, Melbourne",
                mode = "driving",
                key = "<valid_api_key>",
                output_format = "JSON")


## polyline joining the capital cities of Australian states
pl <- "nnseFmpzsZgalNytrXetrG}krKsaif@kivIccvzAvvqfClp~uBlymzA~ocQ}_}iCthxo@srst@"
    
df_polyline <- decodepl(pl)
df_polyline
#         lat      lon
# 1 -37.78808 144.9756
# 2 -35.26356 149.1724
# 3 -33.85217 151.2378
# 4 -27.41079 152.9956
# 5 -12.38293 130.7812
# 6 -31.87756 115.7959
# 7 -34.84988 138.5596
# 8 -42.84375 147.3486


Installation

## install release version from CRAN
install.packages("googleway")

## install development version via github
devtools::install_github("SymbolixAU/googleway")

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • R 96.7%
  • C++ 3.3%