get_routes: Extract and Combine Routes from an 'Azure Maps' Response

View source: R/get_route_directions.R

get_routesR Documentation

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)

Arguments

resp

An httr2_response object, typically from a successful call to req_route_directions.

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.

Examples

## Not run: 
# Assuming 'response' is a successful response from req_route_directions
all_routes_sf <- get_routes(response)
plot(sf::st_geometry(all_routes_sf))

## End(Not run)

azuremapsr documentation built on Aug. 27, 2025, 5:11 p.m.