This workshop will demonstrate how the PCT was built using the open source statistical programming language R, how the underlying data can be accessed from the command-line for reproducible analysis, and how the methods can be used to generate new scenarios of cycling uptake.
There will be 2 courses:
This is an advanced training course with specific pre-requisites. Please only register if you:
In addition, if you want to do routing on your computer:
If you are new to R this course may not be appropriate for you. If you are an intermediate user, it may be worth brushing-up on your R skills, e.g. by taking a free online course such as that provided by DataCamp or by working through Chapter 2 onwards of the open source book Geocomputation with R (see reading list below for more transport-specific resources).
In addition to computer hardware (a laptop) and software (an up-to-date R set-up and experience using R) pre-requisites, you should have read, or at least have working knowledge of the contents of, the following publications, all of which are freely available online:
To ensure your computer is ready for the course, please test that you can run the following lines of R code on your computer, resulting in the map shown below:
install.packages("remotes")
pkgs = c(
"cyclestreets",
"mapview",
"pct",
"sf",
"stats19",
"stplanr",
"tidyverse",
"devtools"
)
remotes::install_cran(pkgs)
# remotes::install_github("ITSLeeds/pct")
To test your computer is ready to work with PCT data in R, try running the following commands. It should result in the map below showing the % of short trips in West Yorkshire made by active modes.
library(pct)
library(dplyr) # in the tidyverse
library(leaflet) # installed alongside mapvew
zones_all = get_pct_zones("west-yorkshire")
lines_all = get_pct_lines("west-yorkshire")
# basic plot
plot(zones_all$geometry)
plot(lines_all$geometry[lines_all$all > 500], col = "red", add = TRUE)
# interactive plot
active = lines_all %>%
mutate(`Percent Active` = (bicycle + foot) / all * 100) %>%
filter(e_dist_km < 5)
pal = colorBin(palette = "RdYlBu", domain = active$`Percent Active`, bins = c(0, 2, 4, 10, 15, 20, 30, 40, 90))
leaflet(data = active) %>%
addProviderTiles(providers$OpenStreetMap.BlackAndWhite) %>%
addPolylines(color = ~pal(`Percent Active`), weight = active$all / 100) %>%
addLegend(pal = pal, values = ~`Percent Active`)
We can also use the data to explore entrenched car dependence, as follows:
# car dependent desire lines
car_dependent = lines_all %>%
mutate(`Percent Drive` = (car_driver) / all * 100) %>%
filter(e_dist_km < 5)
pal = colorBin(palette = "RdYlBu", domain = car_dependent$`Percent Active`, bins = c(0, 20, 40, 60, 80, 100), reverse = TRUE)
leaflet(data = car_dependent) %>%
addProviderTiles(providers$OpenStreetMap.BlackAndWhite) %>%
addPolylines(color = ~pal(`Percent Drive`), weight = active$all / 100) %>%
addLegend(pal = pal, values = ~`Percent Drive`)
Lunch break
Coffee break and presentation of results
Lovelace, Robin, Anna Goodman, Rachel Aldred, Nikolai Berkoff, Ali Abbas, and James Woodcock. 2017. “The Propensity to Cycle Tool: An Open Source Online System for Sustainable Transport Planning.” Journal of Transport and Land Use 10 (1). doi:10.5198/jtlu.2016.862.
Lovelace, Robin, Jakub Nowosad, and Jannes Meunchow. 2019. Geocomputation with R. CRC Press. http://robinlovelace.net/geocompr.