google_nearestRoads: Nearest Roads

Description Usage Arguments See Also Examples

View source: R/google_roads.R

Description

Takes up to 100 independent coordinates and returns the closest road segment for each point. The points passed do not need to be part of a continuous path.

Usage

1
2
3
4
5
6
7
8
google_nearestRoads(
  df_points,
  lat = NULL,
  lon = NULL,
  simplify = TRUE,
  curl_proxy = NULL,
  key = get_api_key("roads")
)

Arguments

df_points

data.frame with at least two columns specifying the latitude & longitude coordinates, with a maximum of 100 pairs of coordinates.

lat

string specifying the column of df_path containing the 'latitude' coordinates. If left NULL, a best-guess will be made

lon

string specifying the column of df_path containing the 'longitude' coordinates. If left NULL, a best-guess will be made

simplify

logical - TRUE indicates the returned JSON will be coerced into a list. FALSE indicates the returend JSON will be returned as a string

curl_proxy

a curl proxy object

key

string A valid Google Developers Places API key

See Also

google_snapToRoads

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 

key <- 'your_api_key'

df_points <- read.table(text = "lat lon
 60.1707 24.9426
 60.1708 24.9424
 60.1709 24.9423", header = T)

google_nearestRoads(df_points, key = key)


## End(Not run)

googleway documentation built on Nov. 16, 2020, 9:08 a.m.