Learn R Programming

azuremapsr (version 0.0.2)

POSTbody_builder_directions_geojson: Build GeoJSON Body for Route Directions

Description

Constructs the GeoJSON part of the request body for the Azure Maps Route Directions API. This includes the origin, destination, and any waypoints.

Usage

POSTbody_builder_directions_geojson(origin, destination, waypoints = NULL)

Value

A list formatted as a GeoJSON FeatureCollection, ready to be included in the API request body.

Arguments

origin

A numeric vector of coordinates (longitude, latitude) or an sf object representing the starting point.

destination

A numeric vector of coordinates (longitude, latitude) or an sf object representing the end point.

waypoints

Optional. A numeric vector, a matrix of coordinates, or an sf object with POINT geometries for intermediate stops.

Examples

Run this code
if (FALSE) {
origin <- c(-122.201399, 47.608678)
destination <- c(-122.201669, 47.615076)
waypoints <- c(-122.20687, 47.612002)
geojson_part <- POSTbody_builder_directions_geojson(origin, destination, waypoints)
}

Run the code above in your browser using DataLab