class: center, middle, inverse, title-slide # The Propensity to Cycle Tool ## 🚲
Advanced Training Workshop ### Robin Lovelace and Malcolm Morgan, University of Leeds ### London, 2019-06-24
--- # Agenda - 09:30 - 10:00: Arrival and set-up - 10:00 - 11:00: Data and methods underlying the PCT - 11:00 - 12:30: Getting and analysing PCT data - Comparing PCT results with existing road infrastructure - Getting data from the CyIPT - Identfying 'weak links' - Identify gaps in the network Lunch break - 13:30 - 15:30: Extending the PCT: minihack - Alternative scenarios of cycling uptake - A 'replace short car trips' scenario - New input data - Travel to stations - Other extensions of the PCT Break and presentation of results - 16:00 - 16:30: Policy implementation --- # The PCT Advanced Workshop Team ### Robin Lovelace - Geographer by Training - University Academic Fellow in Transport and Big Data, Institute for Transport Studies, University of Leeds - Lead Developer of the Propensity to Cycle Tool (Lovelace, Goodman, Aldred, Berkoff, Abbas, and Woodcock, 2017a) - R developer and teacher, author of open source books *Efficient R Programming* and *Gecomputation with R* (Lovelace, Nowosad, and Meunchow, 2019a) -- ### Malcolm Morgan - Civil Engineer by training - Moved into transport via the Propensity to Cycle Tool Project - Interest in machine learning and routing - Focus on multi-modal routing and energy use (UKERC) -- ### How about you? --- ## Housekeeping - The venue + facilities - The agenda + further info can be found on the pct package website: https://github.com/ITSLeeds/pct - And the PCT training vignette: [itsleeds.github.io/pct/articles/pct_training.html](https://itsleeds.github.io/pct/articles/pct_training.html)
--- ## Learning outcomes By the end of the course, you will be able to: - Understand the data and code underlying the PCT - Download data from the PCT at various geographic levels - Use R as a tool for transport data analysis and cycle network planning -- - Do new things with the PCT data and methods that will support the global transition away from fossil fuels 🚀 --- # Geographic levels in the PCT - Generate and analyse route networks for transport planning with reference to: - Origin-destination (OD) data - Geographic desire lines - Route allocation using different routing services - Route network generation and analysis --- ## Transport planning software Transport modelling software products are a vital component of modern transport planning *and* research. - They generate the evidence base on which strategic investments are made and, furthermore, - provide a powerful mechanism for researching alternative futures. -- It would not be an overstatement to say that software determines the range of futures that are visible to policymakers. This makes status of transport modelling software and how it may evolve in the future important questions. What will transport software look like? What will their capabilities be? And who will control? Answers to each of these questions will affect the future of transport systems. -- - Premise: transport planning/modelling software used in practice ~~will become~~ is becoming increasingly data-driven, modular and open. --- ## A geographic perspective - See https://github.com/ITSLeeds/TDS/blob/master/catalogue.md - Paper on the **stplanr** paper for transport planning (available [online](https://cran.r-project.org/web/packages/stplanr/vignettes/stplanr-paper.html)) - Introductory and advanced content on geographic data in R, especially the [transport chapter](http://geocompr.robinlovelace.net/transport.html) (available free [online](http://geocompr.robinlovelace.net/)) (Lovelace, Nowosad, and Meunchow, 2019a) - Paper on analysing OSM data in Python (available [online](https://arxiv.org/pdf/1611.01890)) <img src="https://geocompr.robinlovelace.net/images/cover.png" width="20%" /> --- ## Data science and the tidyverse - Inspired by Introduction to data science with R (available free [online](http://r4ds.had.co.nz/)) (Grolemund and Wickham, 2016a) <img src="https://d33wubrfki0l68.cloudfront.net/b88ef926a004b0fce72b2526b0b5c4413666a4cb/24a30/cover.png" width="30%" /> --- ## Current transport software <table> <caption>Sample of transport modelling software in use by practitioners. Note: citation counts based on searches for company/developer name, the product name and 'transport'. Data source: Google Scholar searches, October 2018.</caption> <thead> <tr> <th style="text-align:left;"> Software </th> <th style="text-align:left;"> Company/Developer </th> <th style="text-align:left;"> Company HQ </th> <th style="text-align:left;"> Licence </th> <th style="text-align:right;"> Citations </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Visum </td> <td style="text-align:left;"> PTV </td> <td style="text-align:left;"> Germany </td> <td style="text-align:left;"> Proprietary </td> <td style="text-align:right;"> 1810 </td> </tr> <tr> <td style="text-align:left;"> MATSim </td> <td style="text-align:left;"> TU Berlin </td> <td style="text-align:left;"> Germany </td> <td style="text-align:left;"> Open source (GPL) </td> <td style="text-align:right;"> 1470 </td> </tr> <tr> <td style="text-align:left;"> TransCAD </td> <td style="text-align:left;"> Caliper </td> <td style="text-align:left;"> USA </td> <td style="text-align:left;"> Proprietary </td> <td style="text-align:right;"> 1360 </td> </tr> <tr> <td style="text-align:left;"> SUMO </td> <td style="text-align:left;"> DLR </td> <td style="text-align:left;"> Germany </td> <td style="text-align:left;"> Open source (EPL) </td> <td style="text-align:right;"> 1310 </td> </tr> <tr> <td style="text-align:left;"> Emme </td> <td style="text-align:left;"> INRO </td> <td style="text-align:left;"> Canada </td> <td style="text-align:left;"> Proprietary </td> <td style="text-align:right;"> 780 </td> </tr> <tr> <td style="text-align:left;"> Cube </td> <td style="text-align:left;"> Citilabs </td> <td style="text-align:left;"> USA </td> <td style="text-align:left;"> Proprietary </td> <td style="text-align:right;"> 400 </td> </tr> <tr> <td style="text-align:left;"> sDNA </td> <td style="text-align:left;"> Cardiff University </td> <td style="text-align:left;"> UK </td> <td style="text-align:left;"> Proprietary </td> <td style="text-align:right;"> 170 </td> </tr> </tbody> </table> --- # Online communities - [gis.stackexchange.com](https://gis.stackexchange.com/questions) has 21,314 questions - [r-sig-geo](http://r-sig-geo.2731867.n2.nabble.com/) has 1000s of posts - RStudio's Discourse community has 65,000+ posts already! -- - No transport equivalent (e.g. earthscience.stackexchange.com is in beta) - Potential for a Discourse forum or similar: transport is not (just) GIS --- background-image: url(https://media.giphy.com/media/YlQQYUIEAZ76o/giphy.gif) background-size: cover class: center, middle # Overview of the PCT --- ## The first prototype of the PCT - Developed at a Hackathon at ODI Leeds in February 2015 - Involved identifying key routes and mapping them - For detailed description, see the first PCT paper (Lovelace et al. 2017) ![](https://raw.githubusercontent.com/npct/pct-team/master/figures/early.png)<!-- --> --- ## Key stages of PCT - It's all reproducible, enabling modifications, e.g.: - Find short routes in which more people drive than cycle -- - Stage 1: get data from web ```r # Set-up, after installing pct and checking out www.pct.bike: library(dplyr) library(sf) desire_lines_all = pct::get_pct_lines(region = "isle-of-wight") %>% top_n(n = 1000, wt = all) ``` --- ## Stage II: Subset data of interest - Interested only in major lines ```r desire_lines = desire_lines_all %>% filter(all > 500) %>% select(geo_code1, geo_code2, all, bicycle, foot, car_driver, rf_dist_km) plot(desire_lines) ``` ![](pct-slides_files/figure-html/unnamed-chunk-6-1.png)<!-- --> --- ## Stage III: Visualisation <!-- A fundamental part of data science is being able to understand your data. --> <!-- That requires visualisation, R is great for that: --> <!-- - Interactively: --> ```r library(tmap) tmap_mode("view") tm_shape(desire_lines) + tm_lines("all") + tm_basemap(server = leaflet::providers$OpenStreetMap) ```
--- ## Stage IV: Origin-destination data analysis - Now we have data in our computer, and verified it works, we can use it - Which places are most car dependent? ```r car_dependent_routes = desire_lines %>% mutate(percent_drive = car_driver / all * 100) %>% filter(rf_dist_km < 3 & rf_dist_km > 1) ``` - Get routes ```r routes = stplanr::line2route(car_dependent_routes) car_dependent_routes$geometry = routes$geometry ``` -- - Any questions? -- - Everyone happy with RStudio? --- # Supporting reference materials All interactive programming/analysis with command line interface involves frequent reference to documentation, and data science is no exception. Places to look for help (in roughly descending order): -- - Your colleague - R's internal help (e.g. with `?functonname` or `vignettes(package = "packagename)`) - Online documentation, e.g. for the pct package: https://itsleeds.github.io/pct/ - *Transport and Geographic Data Science with R*: An introduction to R aimed at transport planners: https://git.io/tds2dayex - The transport chapter ([12](https://geocompr.robinlovelace.net/transport.html)) in the open source book [*Geocomputation with R*](https://geocompr.robinlovelace.net/) - R for Data Science --- # Exercises - If you're happy with R, work through G1 to G8 in the [exercises](https://itsleeds.github.io/pct/articles/pct_training.html#exercises), starting: - G1: Using the PCT's online interface, hosted at [www.pct.bike/m/?r=isle-of-wight](http://www.pct.bike/m/?r=isle-of-wight), identify the MSOA **zone** that has the highest number of people who cycle to work. - If you're just getting started with RStudio: Work through Section 1 of https://git.io/tds2dayex - Getting up to speed with data manipulation in the tidyverse: Work through and reproduce the code in Section [5.2](https://r4ds.had.co.nz/transform.html#filter-rows-with-filter) of R for Data Science. --- # References Grolemund, Garrett and Hadley Wickham (2016). _R for Data Science_. bibtex:grolemund\_ r\_2016. O'Reilly Media. ISBN: 978-1-4919-1039-9. Lovelace, Robin, Anna Goodman, Rachel Aldred, et al. (2017). "The Propensity to Cycle Tool: An open source online system for sustainable transport planning". En. In: _Journal of Transport and Land Use_ 10.1. bibtex:lovelace\_ propensity\_2017. ISSN: 1938-7849. DOI: [10.5198/jtlu.2016.862](https://doi.org/10.5198%2Fjtlu.2016.862). URL: [https://www.jtlu.org/index.php/jtlu/article/view/862](https://www.jtlu.org/index.php/jtlu/article/view/862) (visited on Jun. 01, 2017). Lovelace, Robin, Jakub Nowosad, and Jannes Meunchow (2019). _Geocomputation with R_. bibtex:lovelace\_ geocomputation\_2019. CRC Press. ISBN: 1-138-30451-4. URL: [http://robinlovelace.net/geocompr](http://robinlovelace.net/geocompr) (visited on Oct. 05, 2017).