traveltime: Calculate travel time from ANY coordinate system

Description Usage Arguments Value Examples

View source: R/traveltime.R

Description

Calculate travel time from coordinates via Google Maps API. Can use any coordinate system. The default is "+proj=longlat +datum=WGS84" which is the one Google Maps prefers. Requires a Google Maps dev key.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
traveltime(
  x_start,
  x_end,
  y_start,
  y_end,
  crs = NULL,
  mode,
  key,
  silent = TRUE
)

Arguments

x_start

numeric vector of coordinates in any coordinate format

x_end

numeric vector of coordinates in any coordinate format

y_start

numeric vector of coordinates in any coordinate format

y_end

numeric vector of coordinates in any coordinate format

crs

the coordinate system (e.g. "+proj=utm +zone=32N +datum=WGS84")

mode

mode in gmapdistance package, e.g. "driving".

key

Google API key

Value

data frame with travel time and distance

Examples

1
2
3
traveltime(x_start = 10.73426, y_start = 59.95023,
x_end = 10.74455, y_end = 59.95137,
mode = "driving", key = my_key)

kjetilhaukas/gmapi documentation built on Jan. 1, 2021, 7:20 a.m.