Learn R Programming

osrm (version 1.1)

osrmTableOD: Get Travel Time Matrices Between Origins and Destinations

Description

Build and send OSRM API queries to get travel time matrices between set of origin points and set of destination points

Usage

osrmTableOD(dfo, ido, xo, yo, dfd, idd, xd, yd, limit = 100)

Arguments

dfo
data frame containing origin points identifiers, longitudes and latitudes (WGS84).
ido
identifier field in dfo.
xo
longitude field in dfo.
yo
latitude field in dfo.
dfd
data frame containing destination points identifiers, longitudes and latitudes (WGS84).
idd
identifier field in dfd.
xd
longitude field in dfd.
yd
latitude field in dfd.
limit
table query limit of osrm API in use. The default value (100) is the public API limit.

Value

  • A matrix of time distances (in minutes) between origins and destinations is returned.

See Also

osrmTable, osrmTableErrors

Examples

Run this code
# Load data
data("com")
# Travel time matrix
distcom <- osrmTableOD(dfo = com[1:50,], ido = "comm_id", xo =  "lon", yo =  "lat", 
                       dfd = com[51:100,], idd = "comm_id", xd = "lon", yd = "lat")
# First 5 rows and columns
distcom[1:5,1:5]

Run the code above in your browser using DataLab