openrouteservice R package provides easy access to the openrouteservice (ORS) API from R. It allows you to painlessly consume the following services:

Disclaimer

By using this package, you agree to the ORS terms and conditions.

Installation

The latest release version can be readily obtained from CRAN via a call to

install.packages("openrouteservice")

For running the current development version from GitHub it is recommended to use pak, as it handles the installation of all the necessary packages and their system dependencies automatically.

# install.packages("pak")
pak::pak("GIScience/openrouteservice-r")

Get started

See the package vignette for an overview of the offered functionality.

Local ORS instance

The default is to fire any requests against the free public services at <api.openrouteservice.org>. In order to query a different openrouteservice instance, say a local one, set

options(openrouteservice.url = "http://localhost:8082/ors")

If necessary, endpoint configuration can be further customized through openrouteservice.paths which specifies a named list of paths. The defaults are equivalent of having

options(openrouteservice.paths = list(directions = "v2/directions",
                                      isochrones = "v2/isochrones",
                                      matrix = "v2/matrix",
                                      geocode = "geocode",
                                      pois = "pois",
                                      elevation = "elevation",
                                      optimization = "optimization",
                                      snap = "v2/snap",
                                      export = "v2/export"))

Package news

version 0.6.0

NEW FEATURES

  • Enable export endpoint.

version 0.5.2

NEW FEATURES

  • sf output for snapping.

version 0.5.1

BUG FIXES

  • sf output for POIs endpoint (#81)

version 0.5.0

NEW FEATURES

  • Enable snap endpoint.

Publications using openrouteservice R package

Please feel free to reach out if you would like to have your work added to the list below.

  1. Baumer BS, Kaplan DT, Horton NJ. Modern data science with r. Chapman; Hall/CRC; 2017.

  2. Cervigni E, Renton M, McKenzie FH, Hickling S, Olaru D. Describing and mapping diversity and accessibility of the urban food environment with open data and tools. Applied Geography. 2020;125:102352.

  3. Petricola S, Reinmuth M, Lautenbach S, Hatfield C, Zipf A. Assessing road criticality and loss of healthcare accessibility during floods: The case of cyclone idai, mozambique 2019. International journal of health geographics. 2022;21(1):14.

  4. Weenink P. Overcoming the modifiable areal unit problem (MAUP) of socio-economic variables in real estate modelling PhDthesis . 2022.

  5. Shields N, Willis C, Imms C, McKenzie G, Van Dorsselaer B, Bruder AM, et al. Feasibility of scaling-up a community-based exercise program for young people with disability. Disability and Rehabilitation. 2022;44(9):1669–81.

  6. Veloso R, Cespedes J, Caunhye A, Alem D. Brazilian disaster datasets and real-world instances for optimization and machine learning. Data in brief. 2022;42:108012.

  7. Cubells J, Miralles-Guasch C, Marquet O. E-scooter and bike-share route choice and detours: Modelling the influence of built environment and sociodemographic factors. Journal of transport geography. 2023;111:103664.

  8. Bhowon Y, Prendergast LA, Taylor NF, Shields N. Using geospatial analysis to determine the proximity of community gyms for a population-based cohort of young people with cerebral palsy. Physiotherapy Canada. 2023;e20220064.

  9. Amato S, Benson JS, Stewart B, Sarathy A, Osler T, Hosmer D, et al. Current patterns of trauma center proliferation have not led to proportionate improvements in access to care or mortality after injury: An ecologic study. Journal of Trauma and Acute Care Surgery. 2023;94(6):755–64.

  10. Jain A, LaValley M, Dukes K, Lane K, Winter M, Spangler KR, et al. Modeling health and well-being measures using ZIP code spatial neighborhood patterns. Scientific Reports. 2024;14(1):9180.