Get road distances and routes with R, GraphHopper and OpenStreetMap.


Install rRoad within R with:


And follow the installation instructions from the file in this repository.


After the installation process, you should be able to launch GraphHopper whenever you want from the command line with:

./ web spain-latest.osm.pbf

Where spain-latest.osm.pbf should be the OpenStreetMap data file of your desired region.

With GraphHopper running, you can get results directly in R:

pontevedra <- c(42.4338555, -8.6743651)
coruna <- c(43.3618728, -8.4301933)
roadRoute(from = pontevedra, to = coruna, weighting = "fastest", calc_points = FALSE)


Made with R, GraphHopper and OpenStreetMap data downloaded from Geofabrik.

Original idea: Création d’une matrice de distances routières avec des outils et des données libres (1/2) | R Géomatique by Timothée Giraud. You should check his OSRM R package for a more recent and better tool on this subject.

mfontcada/rRoad documentation built on May 22, 2017, 5:25 a.m.