This function is a wrapper for the Route Service API. It is similar to get_route, except it returns a tibble with only total time and total distance, and also optionally, the start coordinates and end coordinates.
If route = "pt", only the best route is chosen (i.e. n_itineraries = 1).
get_summ_route(
token,
start,
end,
route,
date = Sys.Date(),
time = format(Sys.time(), format = "%T"),
mode = NULL,
max_dist = NULL,
route_geom = FALSE
)If no error occurs, a tibble of 1 x 2 with the variables:
The total time taken for this route
The total distance travelled for this route
If an error occurs, the output will be NA, along with a warning message.
User's API token. This can be retrieved using get_token
Vector of c(lat, lon) coordinates for the route start point
Vector of c(lat, lon) coordinates for the route end point
Type of route. Accepted values are walk, drive, pt (public transport), or cycle
Default = current date. Date for which route is requested.
Default = current time. Time for which route is requested.
Required if route = "pt". Accepted values are transit, bus or rail
Optional if route = "pt". Maximum walking distance
Default = FALSE. Whether to return decoded route_geometry. Please ensure packages googlePolylines and sf are installed and note that this is a lossy conversion.