Skip to contents

Retrieve the base graphs for different modes of transport. Includes all nodes and edges that are used for routing.

Usage

ors_export(
  bbox,
  profile = get_profiles(),
  network = TRUE,
  instance = NULL,
  ...
)

Arguments

bbox

[various]

An object created by st_bbox or any object that can be coerced to a bbox object. Only graphs within these boundaries will be exported.

profile

[character]

Means of transport as supported by OpenRouteService. Defaults to the first profile in a call to get_profiles. For ors_shortest_distances, profile can be a character vector, for all other functions it needs to be a character scalar. For details on all profiles, refer to the backend reference.

network

[logical]

Whether to convert the output to an sfnetwork.

instance

[ors_instance]

Object of an OpenRouteService instance that should be used for route computations. It is recommended to use ors_instance to set an instance globally. This argument should only be used if activating an instance globally is not feasible.

...

Additional arguments passed to the export API.

Value

If sfnetworks is installed, returns an sfnetwork. Otherwise, returns a list with fields nodes and edges. The nodes network contains a column weight that represents the fastest routing duration with the specified profile.

Examples

if (FALSE) { # \dontrun{
library(sfnetworks)
library(ggplot2)

data("pharma")

# export graphs as sfnetwork
exp1 <- ors_export(pharma, network = TRUE)
plot(exp1)

# export graphs as list
exp2 <- ors_export(pharma, network = FALSE)

ggplot(exp2$edges) +
  geom_sf(aes(lwd = weight))

ggplot() +
  geom_sf(data = exp2$nodes, size = 1) +
  geom_sf(data = exp2$edges)} # }