POSTbody_builder_directions_geojson: Build GeoJSON Body for Route Directions

View source: R/bodyBuilder.R

POSTbody_builder_directions_geojsonR Documentation

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)

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.

Value

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

Examples

## Not run: 
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)

## End(Not run)

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