Build and send OSRM API queries to get travel time matrices between objects. This function interfaces the table OSRM service.

osrm_table(
  src = NULL,
  dst = NULL,
  measure = "duration",
  osrm_profile = "driving",
  osrm_server = getOption("osrm.server")
)

Arguments

src

A data frame containing origin objects identifiers, longitudes and latitudes (WGS84). It can also be a SpatialPointsDataFrame, a SpatialPolygonsDataFrame or an sf object. If so, row names are used as identifiers. If dst and src parameters are used, only pairs between scr/dst are computed.

dst

A data frame containing destination objects identifiers, longitudes and latitudes (WGS84). It can also be a SpatialPointsDataFrame a SpatialPolygonsDataFrame or an sf object. If so, row names are used as identifiers.

measure

A character indicating what measures are calculated. It can be "duration" (in minutes), "distance" (meters), or both c('duration', 'distance'). The public server only allows "duration".

osrm_profile

The routing profile to use, e.g. "car", "bike" or "foot" (when not using the public server). Uses getOption("osrm.profile") to retrieve the default profile ("car").

osrm_server

The base URL of the routing server. Uses getOption("osrm.server") to retrieve the current server by default.

Value

A list containing 3 data frames is returned. durations is the matrix of travel times (in minutes); sources and destinations are the coordinates of the origin and destination objects actually used to compute the travel times (WGS84).

See also