Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/udsleeds/openinfra

Open access data for transport research: tools, modelling and simulation
https://github.com/udsleeds/openinfra

Last synced: about 2 months ago
JSON representation

Open access data for transport research: tools, modelling and simulation

Awesome Lists containing this project

README

        

---
output: github_document
bibliography: references.bib
---

[![R-CMD-check](https://github.com/udsleeds/openinfra/workflows/R-CMD-check/badge.svg)](https://github.com/udsleeds/openinfra/actions)
[![R-CMD-check](https://github.com/udsleeds/openinfra/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/udsleeds/openinfra/actions/workflows/R-CMD-check.yaml)

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
echo = TRUE
)
library(sf)
library(tmap)
```

```{r, eval=FALSE, echo=FALSE}
# Generate citations (requires Zotero)
library(rbbt)
bbt_write_bib(path = "references.bib", keys = bbt_detect_citations("README.Rmd"), overwrite = TRUE)
```

# Open access data for transport research: tools, modelling and simulation

# Summary

Getting people walking and cycling has become a priority for many local, regional and national governments in recent years.
Interventions boosting physical activity represent a 'magic bullet', tackling obesity, air pollution and wellbeing.
Active travel is a rapidly growing topic of multi-disciplinary research but has received limited attention from data science perspectives, with a recent paper on modelling cycle network growth [@orozco_datadriven_2020] providing a notable exception.
The work will be grounded in geographic data science, building on previous studies assessing open datasets for transport applications [@ferster_using_2020; @haklay_how_2010a].

In the post-pandemic world, active modes will be even more important due to reduced public transport capacities, as highlighted by the Department for Transport's £250m Active Travel Fund (ATF) and £2bn allocated to walking and cycling over the next 5 years in the UK alone.

New policies and investment programs such as the ATF have led to increased demand for local evidence to inform interventions ranging from new cycleways to improved pavement quality.
This project will the potential of open access transport sources such as OpenStreetMap (OSM) and Ordnance Survey Open Roads (OSOR) datasets, and associated tools, for transport planning to meet active travel objectives.
Specifically, the project will explore how open datasets can be used to understand, prioritise and design active travel infrastructure, such as cycleways, pavements, crossing points and traffic-calming features.
The overall aim is to research and add value to open transport infrastructure data --- and OpenStreetMap data in particular --- for use in transport planning.
The outputs will include new insights, ideas and datasets, leading to a step change in the accessibility, utility and understanding of crowd source data for evidence-based decision making.

# Introduction

This repo contains code and example data to explore the utility of open data for transport planning and, specifically, open data on transport infrastructure.
It was created to support a 12 month LIDA internship, the objectives of which are to:

1. develop new methods for bulk downloading, querying and analysing OpenStreetMap data on transport infrastructure
1. assess the quality of OSM data with reference to ‘ground truth’ datasets including data from satellite imagery and Ordnance Survey data
1. develop a typology of transport infrastructure data and data schemas for each infrastructure type and an actionable definition of ‘active travel infrastructure’
1. articulate ideas on how future research, datasets, software and tools could add value to open transport infrastructure data and support sustainable transport planning practice
1. publish reproducible methods and documentation on using OSM data for transport planning with reference to the strengths and potential pitfalls of the data
1. develop ‘OSM transport infrastructure data packs’ for every transport authority in Great Britain, with layers reflecting a typology of transport infrastructure data developed in the project
1. develop and publish guidance on using OSM data for transport planning
1. suggest a research agenda to enable better use of existing open datasets on transport infrastructure and envision future developments that could make transport planning more transparent, reproducible and participatory

The internship will be undertaken in two 6 month phases, with a rough plan being for objectives 1:4 to be tackled during months 1:6 and objectives 5:8 to be tackled during months 7:12.
An agile approach will be taken whereby objectives can be changed during the internship to pursue promising avenues that emerge.

There are already good tools open tools for working with transport infrastructure data, including the R packages [`osmextract`](https://docs.ropensci.org/osmextract/), [`stplanr`](https://docs.ropensci.org/stplanr/), and [`sfnetworks`](https://luukvdmeer.github.io/sfnetworks/).
These, and packages written in other languages such as Julia and Python, are largely academic-led and technical projects with little uptake among practitioners.
This project will explore the landscape of open transport infrastructure, describe and critique how active travel infrastructure is represented, and document how practitioners can better use open data for evidence-based, transparent and participatory active travel interventions.

Local authority planners and other stakeholders have more data than ever before on transport systems to support their work, especially in relation to travel *behaviour* thanks to datasets from traffic counts, travel surveys and open access tools such as the Propensity to Cycle Tool.

However, there is less accessible data on travel *infrastructure*, especially in relation to walking and cycling.
Good practice on designing for active travel is well known [@departmentfortransport_manual_2007; @parkin_designing_2018] and increasingly recommended/enforced.
Recent government publications provide clear guidance on design parameter for active travel infrastructure, with the recent '[Cycle infrastructure design](https://assets.publishing.service.gov.uk/government/uploads/system/uploads/attachment_data/file/904088/cycle-infrastructure-design-ltn-1-20.pdf)' guidance from the Department for Transport specifying 'desirable' and 'absolute' minimum widths of cycleways of 1.5m and 2m on cycleways with low levels of cycle traffic, for example [@departmentfortransport_cycle_2020].
However, little is known about the extent to which new infrastructure is compliant with such guidance: there is no open data on cycleway widths in most parts of the UK, leading to new approaches to assess compliance using region-specific datasets [@tait_cycling_2022].
Furthermore, new tools building on OSM datasets have been developed, for example to model change in transport infrastructure, prioritise road space reallocation schemes, and identify 'low traffic neighbourhoods' [e.g. @lovelace_open_2021; @lovelace_methods_2020; @lucas-smith_mapping_2021].
The internship will generate new research and publications on additional uses of open data to support sustainable transport planning objectives.

# Example of transport infrastructure in R

The brief example below shows how quickly you can get started with OSM data using command-line driven open source software to ensure reproducibility and scalability, based on an example put together for [ODI Manchester](https://github.com/Robinlovelace/openTransportDataDemo).

If you're new to R, it may be worth reading up on introductory material such as the free and open source resource *Reproducible Road Safety with R* [@lovelace_reproducible_2020] tutorial.
See [Section 1.5](https://itsleeds.github.io/rrsrr/introduction.html#installing-r-and-rstudio) of that tutorial to install R/RStudio and [Section 3](https://itsleeds.github.io/rrsrr/rstudio.html) on getting started with the powerful RStudio editor.
A strength of R is the number of high quality and open access [tutorials](https://education.rstudio.com/learn/beginner/), [books](https://education.rstudio.com/learn/beginner/) and videos to get started.

With R installed, you should be able to run all the code in this example and reproduce the results.

The first step is to install some packages, by entering the following commands into the R console:

```{r}
pkgs = c(
"pct",
"stats19",
"osmextract",
"tmap",
"stplanr",
"od",
"dplyr"
)
```

Install these packages as follows:

```{r, eval=FALSE}
install.packages(pkgs)
```

Load the packages one-by-one with `library(pct)` etc, or all at once as follows:

```{r}
lapply(pkgs, library, character.only = TRUE)[length(pkgs)]
```

One final line of code to set-up the environment is to switch `tmap` into 'view' mode if you want to create interactive maps:

```{r}
tmap_mode("view")
```

We will select the Worseley Building, home of LIDA, as the case study area.
As a starting point, we will use a 2 km buffer around the straight line between LIDA and Leeds city centre to capture movement along this transport corridor:

```{r}
lida_point = tmaptools::geocode_OSM("Worsley Building, Leeds")
leeds_point = tmaptools::geocode_OSM("leeds")
c_m_coordiantes = rbind(lida_point$coords, leeds_point$coords)
c_m_od = od::points_to_od(p = c_m_coordiantes, interzone_only = TRUE)
c_m_desire_line = od::odc_to_sf(c_m_od[-(1:2)])[1, ]
lida_buffer = stplanr::geo_buffer(c_m_desire_line, dist = 2000)
```

```{r}
qtm(lida_buffer)
```

```{r, eval=FALSE}
sf::st_write(lida_buffer, "lida_buffer.geojson")
```
![](unnamed-chunk-8-1.png)

## Transport infrastructure data from osmextract

The following commands get transport infrastructure data.
See documentation on the [`osmextract` website](https://docs.ropensci.org/osmextract/index.html) for details.

```{r, eval=FALSE}
osm_data_full = osmextract::oe_get(lida_buffer, extra_tags = c("maxspeed", "lanes"))
osm_data_region = osm_data_full[lida_buffer, , op = sf::st_within]
summary(factor(osm_data_region$highway))
tmap_mode("plot")
tm_shape(osm_data_region) +
tm_lines(col = "highway")
tmap_save(.Last.value, "osm_highway_map.png")
```

![](osm_highway_map.png)

The same approach can be used to get building polygons:

```{r, eval=FALSE}
q = "select * from multipolygons where building in ('house', 'residential', 'office', 'commercial', 'detached', 'yes')"
osm_data_polygons = osmextract::oe_get(zones, query = q)
osm_data_polygons_region = osm_data_polygons[lida_buffer, , op = sf::st_within]
qtm(zones) +
qtm(osm_data_polygons_region)
saveRDS(osm_data_polygons_region, "osm_data_polygons_region.Rds")
```

There is lots more we can do with this data and other open transport datasets, and this project looks set to identify and document some of the most important uses for sustainable transport planning.

# Further reading

- To get started with R for transport research I recommend Reproducible Road Safety Research with R, an online version of which can be found here: https://itsleeds.github.io/rrsrr/
- To get a deeper understanding of using geographic research transport research, Chapter 12 of the book Geocomputation with R is a great place to start: https://geocompr.robinlovelace.net/transport.html
- For more on A/B Street scenarios, see here: https://a-b-street.github.io/docs/dev/formats/scenarios.html

For any questions, feel free to ask in a GitHub issue track associated with any of the repositories mentioned in this guide.

# References