stplanr: A Package for Transport Planning

Tools for transport planning should be flexible, scalable, and transparent. The stplanr package demonstrates and provides a home for such tools, with an emphasis on spatial transport data and non-motorized modes. The stplanr package facilitates common transport planning tasks including: downloading and cleaning transport datasets; creating geographic “desire lines” from origin-destination (OD) data; route assignment, locally and interfaces to routing services such as; calculation of route segment attributes such as bearing and aggregate flow; and ‘travel watershed’ analysis. This paper demonstrates this functionality using reproducible examples on real transport datasets. More broadly, the experience of developing and using R functions for transport applications shows that open source software can form the basis of a reproducible transport planning workflow. The stplanr package, alongside other packages and open source projects, could provide a more transparent and democratically accountable alternative to the current approach, which is heavily reliant on proprietary and relatively inaccessible software.

Robin Lovelace , Richard Ellison

Supplementary materials

Supplementary materials are available in addition to this article. It can be downloaded at

CRAN packages used

sp, rgeos, rgdal, sf, SpatialEpi, diseasemapping, leaflet, tmap, mapview, mapmisc, XML, twitteR, ggplot2, muStat, mgcv, shiny, haven, rio, dplyr, osmdata, stats19, bikedata, stplanr, nycflights, nycflights13, cyclestreets, igraph, Rcpp, aspace, MCI

CRAN Task Views implied by cited packages

Spatial, WebTechnologies, Graphics, OfficialStatistics, SpatioTemporal, Bayesian, Databases, Econometrics, Environmetrics, gR, HighPerformanceComputing, ModelDeployment, NumericalMathematics, Optimization, Phylogenetics, SocialSciences


Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: "Figure from ...".


For attribution, please cite this work as

Lovelace & Ellison, "The R Journal: stplanr: A Package for Transport Planning", The R Journal, 2018

BibTeX citation

  author = {Lovelace, Robin and Ellison, Richard},
  title = {The R Journal: stplanr: A Package for Transport Planning},
  journal = {The R Journal},
  year = {2018},
  note = {},
  doi = {10.32614/RJ-2018-053},
  volume = {10},
  issue = {2},
  issn = {2073-4859},
  pages = {7-23}