get_routes: Extract and Combine Routes from an 'Azure Maps' Response
Description
This function takes a successful response object from the 'Azure Maps' API,
extracts the main route and any alternative routes, and combines them into a
single sf object.
Usage
get_routes(resp)
Value
An sf object containing the combined main and alternative routes.
If the request was not successful (status code is not 200), the function
will stop with an error.
Arguments
resp
An httr2_response object, typically from a successful call to
req_route_directions.
if (FALSE) {
# Assuming 'response' is a successful response from req_route_directionsall_routes_sf <- get_routes(response)
plot(sf::st_geometry(all_routes_sf))
}