class: center, middle, inverse, title-slide # Geocomputation for active transport planning ## 🚲
a case study of cycle network design
Slides:
github.com/Robinlovelace/erum18-transport
### Robin Lovelace ### 2018-05-16 --- # Outline .pull-left[ ## The problem ## Solutions ## How R can help ] -- .pull-right[ ![](https://media.giphy.com/media/oedEsOtNFyODC/giphy.gif) ] --- # whoami .pull-left[ - Environmental geographer - Learned R for PhD on energy and transport - Now work at the University of Leeds (ITS and LIDA) - Working on Geocomputation with R ```r devtools::install_github("r-rust/gifski") system("youtube-dl https://youtu.be/CzxeJlgePV4 -o v.mp4") system("ffmpeg -i v.mp4 -t 00:00:03 -c copy out.mp4") system("ffmpeg -i out.mp4 frame%04d.png ") f = list.files(pattern = "frame") gifski::gifski(f, gif_file = "g.gif", width = 200, height = 200) ``` ] -- .pull-right[ Image credit: Jeroen Ooms + others ```r knitr::include_graphics("https://user-images.githubusercontent.com/1825120/39661313-534efd66-5047-11e8-8d99-a5597fe160ff.gif") ``` <img src="https://user-images.githubusercontent.com/1825120/39661313-534efd66-5047-11e8-8d99-a5597fe160ff.gif" width="100%" /> ] --- class: inverse, center, middle # The problem --- background-image: url(https://pbs.twimg.com/media/DOH94nXUIAAgcll.jpg) background-position: 50% 50% class: center, bottom, inverse # Cities look a bit like this --- # Transport: growing source of emissions .pull-left[ ```r knitr::include_graphics("https://raw.githubusercontent.com/Robinlovelace/erum18-transport/master/transport-projections-ipcc.png") ``` ![](https://raw.githubusercontent.com/Robinlovelace/erum18-transport/master/transport-projections-ipcc.png)<!-- --> ] -- .pull-right[ - People like to travel! - Does not 'saturate' with income - Hard to decarbonise via technology ![](https://media2.giphy.com/media/3o7TKOB6oTdYPFXJmw/giphy.gif) ![](https://media1.giphy.com/media/YlQQYUIEAZ76o/200w.gif) ] --- class: inverse, center, middle # Solutions --- # Make cycling the natural choice <img src="https://pbs.twimg.com/media/DJaWCo0U8AAzQGW.jpg:large" width="70%" /> Source: [Brent Toderian](https://twitter.com/BrentToderian) -- ## For everyone: a political problem --- # Another problem... <img src="https://larrycuban.files.wordpress.com/2015/02/data-overload-2.jpg" width="80%" /> -- ## Data overload <!-- Source: [Larry Cuban](https://larrycuban.files.wordpress.com/2015/02/data-overload-2.jpg) --> --- class: inverse, center, middle # Technical solutions --- # Simplify the data deluge Cycling network in Seville: 'basic' (77 km) and ‘complementary’ (120 km, dashed line) cycleways (from Marqués et al. 2015). Led to fourfold increase in cycling. ![](https://raw.githubusercontent.com/ATFutures/who/master/fig/sevnet2.png)<!-- --> --- ## Estimate cycling pontential: the Propensity to Cycle Tool - see [w](http://npct0.vs.mythic-beasts.com/shiny_interface/?r=west-yorkshire)[ww.pct.bike](www.pct.bike) Included in UK policy (CWIS) used by many local authorities (LCWIP) (Lovelace, Goodman, Aldred, Berkoff, Abbas, and Woodcock, 2017) <img src="https://raw.githubusercontent.com/npct/pct-team/master/figures/front-page-leeds-pct-demo.png" width="70%" /> --- # Build infrastructure - Link between infrastructure and uptake between 2001 and 2011 in English regions - But how to ensure that infrastructure is effective? <img src="https://raw.githubusercontent.com/cyipt/cyipt-website/master/images/ttwa-uptake.png" width="80%" /> --- # Identify cost-effective schemes: the CyIPT - A ~~publicly available~~ password protected web app providing accessible evidence on cycling infrastructure hosted at [www.cyipt.bike](https://www.cyipt.bike/) ![](https://www.cyipt.bike/images/home-example.png)<!-- --> --- class: inverse, center, middle # How R can help An open source language for statistical computing (R Core Team, 2018) --- # Scalability
--- # Visualisation - Live demo... ```r # try it! shiny::runGitHub("robinlovelace/erum18-transport") ``` - More on shiny-leaflet integration: [Section 9.5](http://geocompr.robinlovelace.net/adv-map.html#mapping-applications) in (Lovelace, Nowosad, and Meunchow, 2018) - **stplanr** (Pebesma, 2018) making use of **sf** (Lovelace and Ellison, 2018) --- # Some example shiny code ```r # non-reproducible snippet getroads = reactive({ roads[roads$highway == input$type, ] }) renderLeaflet({ m = tm_shape(getroads()) + tm_lines(col = "red", lwd = 5) + tmap_leaflet(m) # you can use tmap in shiny! }) ``` --- # Local routing .pull-left[ ```r fr = stplanr::geo_code( "Budapest airport") to = stplanr::geo_code( "akvarium budapest") # install.packages("cyclestreets") library(cyclestreets) r = journey(fr, to) ``` ```r # From Martin's workshop: library(tmap) bm = leaflet::providers bm_cycle = bm$Thunderforest.OpenCycleMap m = tm_shape(r) + tm_lines(col = "busynance", lwd = 5) + tm_scale_bar() ``` ] .pull-right[ See: [rpubs.com/RobinLovelace/389709](http://rpubs.com/RobinLovelace/389709) ```r tmap_leaflet(m) ```
] --- # Extracting data from routes ```r r$distances[1:5] ``` ``` ## [1] 159 2176 21 105 271 ``` ```r r$time[1:5] ``` ``` ## [1] 52 7393 18 72 60 ``` ```r sum(r$distances) / 1000 ``` ``` ## [1] 24.59 ``` For something on remote routing see **stplanr** or **dodgr** packages. - Vignette on fast local routing: [cran.r-project.org/package=dodgr](https://cran.r-project.org/web/packages/dodgr/vignettes/dodgr.html) --- class: center, middle # Thanks and safe 🚶, 🚲 + 🚀! - Reproducible slides + app: [github.com/Robinlovelace/erum18-transport](https://github.com/Robinlovelace/erum18-transport) - Transport chapter in Geocomputation with R (feedback welcome): [geocompr.robinlovelace.net](http://geocompr.robinlovelace.net/transport.html) Slides created via the R package [**xaringan**](https://github.com/yihui/xaringan). --- class: small # References Lovelace, Robin and Richard Ellison (2018). _Stplanr: Sustainable Transport Planning_. R package version 0.2.4. URL: [https://github.com/ropensci/stplanr](https://github.com/ropensci/stplanr). Lovelace, Robin, Anna Goodman, Rachel Aldred, et al. (2017). "The Propensity to Cycle Tool: An Open Source Online System for Sustainable Transport Planning". In: _Journal of Transport and Land Use_ 10.1. ISSN: 1938-7849. DOI: [10.5198/jtlu.2016.862](https://doi.org/10.5198/jtlu.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 (2018). _Geocomputation with R_. CRC Press. URL: [http://robinlovelace.net/geocompr](http://robinlovelace.net/geocompr) (visited on Oct. 05, 2017). Pebesma, Edzer (2018). _Sf: Simple Features for R_. R package version 0.6-3. URL: [https://github.com/r-spatial/sf/](https://github.com/r-spatial/sf/). R Core Team (2018). _R: A Language and Environment for Statistical Computing_. Vienna, Austria. URL: [https://www.R-project.org/](https://www.R-project.org/). <img src="https://www.cyipt.bike/images/logo.png" height="100" /><img src="https://raw.githubusercontent.com/cyipt/cyipt/master/figures/its-logo-square.png" height="100" />