New release of osrm


Timothée Giraud


November 4, 2022

osrm is an interface between R and the Open Source Routing Machine (OSRM) API. OSRM (Luxen and Vetter 2011) is a routing service based on OpenStreetMap (OSM) data. This package enables the computation of routes, trips, isochrones and travel distances matrices (travel times and kilometric distances) based on the OSM road network.

A major update of osrm has been deployed on CRAN two weeks ago. In this article I’ll describe the changes introduced by this update and explain its context: the submission of a paper (Giraud 2022) about the package in Journal of Open Source Software (JOSS).

What has changed

This major release introduces a number of changes to the package API, some of them are breaking changes.

sp support

Users will no longer have the possibility to use an sp object as input or output in osrm functions. Most of #rspatial users and package developers have moved from the old sp/rgeos/rgdal trilogy toward the sf package.

Refactoring of the request handling process

The way requests are sent to the OSRM server (local/remote/demo) has been refactored in order to get more informative messages. Indeed, an important share of the issues posted on the osrm GitHub repo has been about cryptic or non helpful error messages sent by the package or the server. So in this release OSRM server errors are more explicit and better transmitted to the user.


OSRM request are received as json files to the package. Former versions of the package used jsonlite. Following a suggestion by Nick Young I’ve replaced this package by a much more efficient package (for large files), RcppSimdJson.
The construction of isochrones as polygons was based on an ad-hoc code supported by isoband. This piece of code was replicated in 2 other packages (tanaka and potential). I’ve decided to create the mapiso package to avoid an unnecessary maintenance burden and fortify the underlying code.

Input types

Input type checking has been largely improved. This improvement have lead to a modification of the set of valid input of functions. Most functions accept data.frame, matrix, sfc or sf objects. The way identifier are handled has also been improved (use of row.names or indexes if row.names are not relevant, e.g. for sfc objects or some matrices).

See the NEWS file for the complete list of changes.

The paper in JOSS

From JOSS documentation:
JOSS publishes articles about research software. JOSS submissions must be open source and have an obvious research application. After submission an editor will carry out an initial check of your submission, and proceed to assign a handling editor. The handling editor will assign two or more JOSS reviewers, and the review will be carried out in the JOSS reviews repository. Authors will respond to reviewer-raised issues on the submission repository’s issue tracker.

The review process of the paper happens in the open. You can have a look at it here.
Submitting a paper to JOSS assure you to have your software inspected by a set of competent people and I can say that this process help me to make the package more ergonomic and reliable.

If you want more detailed information on JOSS, a paper by Smith et al. (2018) describes the motivation, design, and progress of the journal.


Giraud, Timothée. 2022. osrm: Interface Between R and the OpenStreetMap-Based Routing Service OSRM.” Journal of Open Source Software 7 (78): 4574.
Luxen, Dennis, and Christian Vetter. 2011. “Real-Time Routing with OpenStreetMap Data.” In Proceedings of the 19th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems, 513–16. GIS ’11. New York, NY, USA: ACM.
Smith, Arfon M., Kyle E. Niemeyer, Daniel S. Katz, Lorena A. Barba, George Githinji, Melissa Gymrek, Kathryn D. Huff, et al. 2018. Journal of Open Source Software (JOSS): Design and First-Year Review.” PeerJ Computer Science 4 (February): e147.