Learn R Programming

osrm (version 1.1)

osrmTable: Get Travel Time Matrices Between Points

Description

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

Usage

osrmTable(df, id, x, y)

Arguments

df
data frame containing points identifiers, longitudes and latitudes (WGS84).
id
identifier field in df.
x
longitude field in df.
y
latitude field in df.

Value

  • x A square matrix of time travel (in minutes) is returned.

See Also

osrmTableOD, osrmTableErrors

Examples

Run this code
# Load data
data("com")
# Travel time matrix
distcom <- osrmTable(com[1:50,], id = "comm_id", x =  "lon",y =  "lat")
# First 5 rows and columns
distcom[1:5,1:5]

Run the code above in your browser using DataLab