A newer and better version is available here: https://urutau.co.nz/how-to/osrm/
- Tom Logan
- Andrew Nisbet
- Tim Williams
Use of this code is free with the citation:
Logan, T. M., T. G. Williams, A. J. Nisbet, K. D. Liberman, C. T. Zuo, and S. D. Guikema. 2017. “Evaluating Urban Accessibility: Leveraging Open-Source Data and Analytics to Overcome Existing Limitations.” Environment and Planning B: Urban Analytics and City Science, November.
Check out our blog: https://urutau.co.nz/research/evaluating-accessibility/
The Open Source Routing Machine (OSRM) is a tool that calculates optimal routes for a given geographical area and a given transport profile (car, bicycle, pedestrian, etc). How to use OSRM depends on the operating system you are using: Mac and Linux are supported by the OSRM team, while we have provided code for setting up OSRM on Windows.
Up-to-date instructions for installing OSRM on Mac and Linux are given on the OSRM project page:https://github.com/Project-OSRM/osrm-backend#quick-start . Once running, the url of the OSRM server can be passed to the provided R code using the osrm.url
variable.
- Download an OpenStreetMap
.osm.pbf
file for the region you are interested in. You can get these from sources such as http://download.geofabrik.de/ . The location of this file should be theosm.pbf.path
variable in the R code. - Set up a transport
.lua
profile. It's best to start with one of the profiles included in thelib/osrm/profiles
, and modify it to your needs. You can change things like speeds for different road surfaces, penalties for turns, and which road classes are allowed to be taken. The location of this file should be theosrm.profile.path
variable. - Modify the other parameters of the code as required/desired and run. The function
StartOSRMServer
will set up an OSRM server that is used by the rest of the code, or could be accessed for your own calculations.