Cycle Routing and Data for Cycling Advocacy

An interface to the cycle routing/data services provided by 'CycleStreets', a not-for-profit social enterprise and advocacy organisation. The application programming interfaces (APIs) provided by 'CycleStreets' are documented at (< https://www.cyclestreets.net/api/>). The focus of this package is the journey planning API, which aims to emulate the routes taken by a knowledgeable cyclist. An innovative feature of the routing service of its provision of fastest, quietest and balanced profiles. These represent routes taken to minimise time, avoid traffic and compromise between the two, respectively.


AppVeyor Build Status

The goal of cyclestreets is to provide a simple R interface to the CycleStreets.net routing service.

It was split-out from stplanr for modularity.

Installation

Install the package with devtools as follows:

devtools::install_github("Robinlovelace/cyclestreets")

Example

A common need is to get from A to B:

library ("cyclestreets")
# stplanr::geo_code ("leeds rail station") 
from = c(-1.544, 53.794)
# stplanr::geo_code ("leeds university") 
to = c(-1.551, 53.807)
r = cyclestreets::journey(from, to, "balanced")
sf:::plot.sf(r)

To get a key go to https://www.cyclestreets.net/api/apply/

Save the key as an environment varible using export CYCLESTREETS=your_key_here by adding CYCLESTREETS=your_key_here as a new line in your .Renviron file, e.g. with the following command:

usethis::edit_r_environ()

Check the map is good with leaflet:

library(leaflet)
p = colorNumeric("RdYlBu", domain = r$busynance, reverse = TRUE)
leaflet(r) %>% 
  addTiles() %>% 
  addPolylines(color = ~p(busynance), weight = 20, opacity = 0.9) %>% 
  addLegend(pal = p, values = ~busynance)

Route types available are: fastest, quietest, balanced. See help pages such as ?journey and https://www.cyclestreets.net/api/ for details.

News

cyclestreets 0.1.5

  • Update package description, title and other things in preparation for CRAN submission.

cyclestreets 0.1.1

  • New argument cols added to journey() function allowing control of the output.
  • Many more columns can now be accessed as illustrated by new example: journey(from, to, cols = NULL).

cyclestreets 0.1.0

  • Package created as part of the R for Transport Applications course at the University of Leeds.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("cyclestreets")

0.1.5 by Robin Lovelace, a year ago


Browse source code at https://github.com/cran/cyclestreets


Authors: Robin Lovelace [aut, cre] , Martin Lucas-Smith [aut] , Eric Krueger [ctb]


Documentation:   PDF Manual  


GPL-3 license


Imports sf, magrittr, jsonlite, httr, stringr


Suggested by stplanr.


See at CRAN