All Projects → riatelab → Osrm

riatelab / Osrm

Shortest Paths and Travel Time from OpenStreetMap with R

Programming Languages

r
7636 projects

Projects that are alternatives of or similar to Osrm

Configr
Implements the JSON, INI, YAML and TOML parser, for R setting and writing of configuration file.
Stars: ✭ 38 (-76.25%)
Mutual labels:  r-package, cran
Wooldridge
The official R data package for "Introductory Econometrics: A Modern Approach". A vignette contains example models from each chapter.
Stars: ✭ 90 (-43.75%)
Mutual labels:  r-package, cran
Nanotime
Nanosecond Resolution Time Functionality for R
Stars: ✭ 39 (-75.62%)
Mutual labels:  r-package, cran
digest
R package to create compact hash digests of R objects
Stars: ✭ 94 (-41.25%)
Mutual labels:  cran, r-package
Minicran
R package to create internally consistent, mini version of CRAN
Stars: ✭ 123 (-23.12%)
Mutual labels:  r-package, cran
Dataexplorer
Automate Data Exploration and Treatment
Stars: ✭ 362 (+126.25%)
Mutual labels:  r-package, cran
Markovchain
Easy Handling Discrete Time Markov Chains
Stars: ✭ 80 (-50%)
Mutual labels:  r-package, cran
PackageDevelopment
Task View: PackageDevelopment
Stars: ✭ 38 (-76.25%)
Mutual labels:  cran, r-package
Osmplotr
Data visualisation using OpenStreetMap objects
Stars: ✭ 122 (-23.75%)
Mutual labels:  r-package, openstreetmap
Mlr
Machine Learning in R
Stars: ✭ 1,542 (+863.75%)
Mutual labels:  r-package, cran
rcppgsl
Rcpp integration for GNU GSL vectors and matrices
Stars: ✭ 28 (-82.5%)
Mutual labels:  cran, r-package
Rblpapi
R package interfacing the Bloomberg API from https://www.bloomberglabs.com/api/
Stars: ✭ 133 (-16.87%)
Mutual labels:  r-package, cran
xfun
Miscellaneous R functions
Stars: ✭ 102 (-36.25%)
Mutual labels:  cran, r-package
Rcpp
Seamless R and C++ Integration
Stars: ✭ 572 (+257.5%)
Mutual labels:  r-package, cran
UCSCXenaShiny
📊 An R package for interactively exploring UCSC Xena https://xenabrowser.net/datapages/
Stars: ✭ 52 (-67.5%)
Mutual labels:  cran, r-package
Pkgsearch
Search R packages on CRAN
Stars: ✭ 73 (-54.37%)
Mutual labels:  r-package, cran
FLightR
R package to position animals with solar geolocation archival tags
Stars: ✭ 16 (-90%)
Mutual labels:  cran, r-package
pbapply
Adding progress bar to '*apply' functions in R
Stars: ✭ 115 (-28.12%)
Mutual labels:  cran, r-package
Rinside
Seamless embedding of R in C++ programs
Stars: ✭ 112 (-30%)
Mutual labels:  r-package, cran
Drat
Drat R Archive Template
Stars: ✭ 127 (-20.62%)
Mutual labels:  r-package, cran

osrm R package

Version R build status codecov

Interface Between R and the OpenStreetMap-Based Routing Service OSRM

Description

OSRM is a routing service based on OpenStreetMap data. See http://project-osrm.org/ for more information. This package allows to compute routes, trips, isochrones and travel distances matrices (travel time and kilometric distance).

This package relies on the usage of a running OSRM service (tested with v5.23.0 of OSRM).

You can run your own instance of OSRM following guidelines provided here. The simplest solution is probably the one based on docker containers.

⚠️ You must be careful using the OSRM demo server and read the about page of the service:
> One request per second max. No scraping, no heavy usage.

❗️ To consider when using OSRM:
> “Most of the previously active core devs have either moved on to new roles, or are simply busy on different projects (…)”

Features

  • osrmTable Get travel time matrices between points.

  • osrmRoute Get the shortest path between two points.

  • osrmTrip Get the travel geometry between multiple unordered points.

  • osrmIsochrone Get polygons of isochrones.

Demo

osrmTable

library(osrm)
data("berlin")
# Travel time matrix
distA <- osrmTable(loc = apotheke.sf[1:5,])
distA$durations
440338666 538057637 977657079 3770254015 364363337
440338666 0.0 21.4 34.1 19.5 11.7
538057637 22.8 0.0 42.8 16.1 20.7
977657079 34.1 43.3 0.0 31.2 27.4
3770254015 22.3 15.3 30.7 0.0 12.7
364363337 12.0 20.2 26.8 12.0 0.0

osrmRoute

library(sf)
library(maptiles)
library(mapsf)
# Route
route <- osrmRoute(src = apotheke.sf[74,], dst = apotheke.sf[55,],
                   overview = "full", returnclass = "sf")
# Display
osm <- get_tiles(x = route, crop = TRUE, zoom = 13)
png("img/route.png", width = 693, height = 263)
par(mar = c(0,0,0,0))
plot_tiles(osm)
mf_map(route, lwd = 4, add = TRUE, col = "black")
mf_map(route, lwd = 1, col = "white", add = TRUE)
mf_map(apotheke.sf[c(74,55),], pch = 20, col = "red", add = TRUE)
mf_credits(get_credit("OpenStreetMap"), pos = "bottomright", cex = .9)
dev.off()

osrmTrip

# Trip 
trips <- osrmTrip(loc = apotheke.sf[10:20,], returnclass="sf")
trip <- trips[[1]]$trip
# Display
osm2 <- get_tiles(x = trip, crop = TRUE, zoom = 11)
png("img/trip.png", width = 499, height = 420)
par(mar = c(0,0,0,0))
plot_tiles(osm2)
mf_map(trip, col = "black", lwd = 4, add = TRUE )
mf_map(trip, col = c("red", "white"), lwd = 1, add = TRUE)
mf_map(apotheke.sf[10:20,], pch = 21, col = "red", cex = 1.5, add = TRUE)
mf_credits(get_credit("OpenStreetMap"), pos = "bottomright", cex = .9)
dev.off()

osrmIsochrone

bks <- seq(from = 0, to = 14, by = 2)
iso <- osrmIsochrone(loc = apotheke.sf[87,], returnclass="sf",
                     breaks = bks, res = 70)
osm3 <- get_tiles(x = iso, crop = TRUE, zoom = 12)
cols <- hcl.colors(n = 7, palette = "Emrld", alpha = 0.75, rev = F)
png("img/iso.png", width = 604, height = 595)
par(mar = c(0,0,0,0))
plot_tiles(osm3)
mf_theme(mar = c(0,0,0,0))
mf_map(x = iso, var = "center", type = "choro", 
       breaks = bks, border = NA, pal = cols,
       leg_pos = "topleft", leg_frame = T,
       leg_title = "Isochrones\n(min)",
       leg_title_cex = 1, leg_val_cex = .8,
       add = TRUE)
mf_map(apotheke.sf[87,], pch = 21, col = "red", 
       cex = 1.5, add=TRUE)
mf_credits(get_credit("OpenStreetMap"), cex = .9)
dev.off()

Installation

  • Development version on GitHub
remotes::install_github("riatelab/osrm")
  • Stable version on CRAN
install.packages("osrm")

Community Guidelines

One can contribute to the package through pull requests and report issues or ask questions here.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].