Learn R Programming

azuremapsr (version 0.0.2)

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.

Examples

Run this code
if (FALSE) {
# Assuming 'response' is a successful response from req_route_directions
all_routes_sf <- get_routes(response)
plot(sf::st_geometry(all_routes_sf))
}

Run the code above in your browser using DataLab