access_result: Access Result

View source: R/results_access.R

access_resultR Documentation

Access Result

Description

Methods for accessing specific elements of a Google API query.

Usage

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

  • direction_instructions: the instructions from a directions query

  • direction_routes: the routes from a directions query

  • direction_legs: the legs from a directions query

  • direction_steps: the steps from a directions query

  • direction_points: the points from a directions query

  • direction_polyline: the encoded polyline from a direction query

  • distance_origins: the origin addresses from a distance query

  • distance_destinations: the destination addresses from a distance query

  • distance_elements: the element results from a distance query

  • elevation: the elevation from an elevation query

  • elevation_location: the elevation from an elevation query

  • geocode_coordinates: the coordinates from a geocode or reverse geocode query

  • geocode_address: the formatted address from a geocode or reverse geocode query

  • geocode_address_components: the address components from a geocode or reverse geocode query

  • geocode_place: the place id from a geocode or reverse geocode query

  • geocode_type: the geocoded place types from a geocode or reverse geocode query

  • place: the place_id from a places query

  • place_next_page: the next page token from a places query

  • place_name: the place name from a places query

  • place_location: the location from a places query

  • place_type: the type of place from a places query

  • place_hours: the opening hours from a place details query

  • place_open: the open now result from a place details query

  • nearest_roads_coordinates: the coordinates from a nearest roads query

Examples

## 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 March 18, 2022, 7:34 p.m.