Advanced topics
1 Visualising large datasets
Install and try visualising datasets from previous sessions with:
- {
mapgl
}: an R interface to Mapbox GL JS for rendering large spatial datasets. - {
tmap.gl
}: Use your existingtmap
code, that builds onmapgl
- The {
nptscot/pmtiles
} GitHub package provides tools for creating vector tiles in R (advanced).
2 Route network integration
- Take a read of the networkmerge paper and try to reproduce some of the code
- Search for and download the Ordnance Survey’s OpenRoads data product
- Check-out the
stplanr
functionrnet_join()
for joining different route networks, e.g. walking and cycling networks. - Check-out the
anime
package for astonishingly fast network joining (advanced).
3 Deploying your work as web applications
- Think about the project that you’re working on that would have the maximum benefit from being deployed as a web application.
- Sketch out the user interface and user experience (UI/UX) of the application.
- Sketch the data flow and architecture of backend systems.
- Read-up on the
targets
package for reproducible pipelines. - Take a look at the source code of some deployed web applications for inspiration
- Check out the code in the
nptscot/nptscot
andnptscot/nptscot.github.io
repositories, plus the resulting app at npt.scot. - Look for the source code associated with other apps including pctni.org, pct.bike and other apps of your choice.
3.1 Examples of R-based Transport Web Apps
3.1.1 Propensity to Cycle Tool (PCT)
The PCT is an open-source planning support system for sustainable transport, providing evidence-based cycling scenarios across England and Wales.
(Interactive map screenshot: Cycling potential layers over England and Wales, showing commute scenarios with color-coded routes)
- Built with Shiny and Leaflet for interactive maps
- Scenarios include Government Target, Go Dutch, Ebike; layers for commute/school trips
- Best practices: Integrate open data (census, OSM), enable scenario modeling for policy impact, use open-source for community contributions
- Source: pct.bike, GitHub npct/pct; see paper for methodology
3.1.2 Propensity to Cycle Tool for Northern Ireland (PCTNI)
An alpha version adapted for Northern Ireland, building on PCT and NPT.
(Interactive map screenshot: Route network layers for Northern Ireland, highlighting fastest/quietest cycling routes)
- Features route networks (fastest/quietest), cycle infrastructure layers
- Based on 2011 Census for work trips; active development with OSM integration
- Best practices: Iterative releases with issue tracking, validate against local data, emphasize limitations for responsible use
- Source: pctni.org, GitHub pctni
Reuse
Copyright
© 2025 Robin Lovelace