access_result: Access Result

Description Usage Arguments Functions Examples

View source: R/results_access.R

Description

Methods for accessing specific elements of a Google API query.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
access_result(
  res,
  result = c("instructions", "routes", "legs", "steps", "points", "polyline",
    "coordinates", "address", "address_components", "geo_place_id", "dist_origins",
    "dist_destinations", "elevation", "elev_location", "place", "place_name",
    "next_page", "place_location", "place_type", "place_hours", "place_open")
)

direction_instructions(res)

direction_routes(res)

direction_legs(res)

direction_steps(res)

direction_points(res)

direction_polyline(res)

distance_origins(res)

distance_destinations(res)

distance_elements(res)

elevation(res)

elevation_location(res)

geocode_coordinates(res)

geocode_address(res)

geocode_address_components(res)

geocode_place(res)

geocode_type(res)

place(res)

place_next_page(res)

place_name(res)

place_location(res)

place_type(res)

place_hours(res)

place_open(res)

nearest_roads_coordinates(res)

Arguments

res

result from a Google API query

result

the specific field of the result you want to access

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 

apiKey <- "your_api_key"

## results returned as a list (simplify == TRUE)
lst <- google_directions(origin = c(-37.8179746, 144.9668636),
                        destination = c(-37.81659, 144.9841),
                        mode = "walking",
                        key = apiKey,
                        simplify = TRUE)

## results returned as raw JSON character vector
js <- google_directions(origin = c(-37.8179746, 144.9668636),
                         destination = c(-37.81659, 144.9841),
                        mode = "walking",
                         key = apiKey,
                         simplify = FALSE)

access_result(js, "polyline")

direction_polyline(js)


## End(Not run)

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