Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/robinlovelace/pollutedroutes

Identification of travel routes commonly walked and cycled for air pollution research
https://github.com/robinlovelace/pollutedroutes

air-quality cycling hackathon rstats transport walking

Last synced: about 1 month ago
JSON representation

Identification of travel routes commonly walked and cycled for air pollution research

Awesome Lists containing this project

README

        

---
output: github_document
always_allow_html: yes
---

# pollutedRoutes
Identification of travel routes commonly walked and cycled for air pollution research

## Download route data

There is a large open dataset on travel to work patterns provided by WICID.

A pre-processed and geographically specific version of this dataset was made available by the Propensity to Cycle Tool (PCT) project (Lovelace et al. 2016).

This can be downloaded, and subset to Leeds as follows:

```{r}
url_lines = "https://github.com/npct/pct-data/raw/master/west-yorkshire/l.Rds"
download.file(url = url_lines, destfile = "l.Rds")
l = readRDS("l.Rds")
most_walked = head(order(l$foot, decreasing = TRUE), n = 5)
l_most_walked = l[most_walked,]
plot(l_most_walked)
```

Let's save that into a language-neutral open geographic file format:

```{r}
geojsonio::geojson_write(input = l_most_walked, file = "l_most_walked.geojson")
```

We can plot this as an interactive map as follows:

```{r}
library(leaflet)
leaflet() %>%
addTiles() %>%
addPolylines(data = l_most_walked)
```

How many trips are represented in that data?

```{r}
sum(l_most_walked$all)
```

Wow, 5000 trips in just 5 routes: that's a LOT of travel into the centre of Leeds from 5 of the clostest MSOA zones (average population: ~7000).

How many of those are walked?

```{r}
sum(l_most_walked$foot)
```

Over half of them!

That should not be a surprise as the distances involved are so short, averaging around 1.5 km straight-line distance:

```{r}
library(stplanr)
line_length(l_most_walked) # results in m
```

## Route allocation

We can allocate these routes to the travel network using a routing service such as GraphHopper:

```{r}
r_most_walked = line2route(l = l_most_walked, route_fun = route_graphhopper, vehicle = "foot")
plot(r_most_walked)
geojsonio::geojson_write(input = r_most_walked, file = "r_most_walked.geojson")
```

We can look at the buffer of likely walked routes now, as follows:

```{r}
r_buff = buff_geo(shp = r_most_walked, width = 200) # 200 m buffer
plot(r_buff)
```

That represents corridors with high numbers of walkers commuting who may be vulnerable to air polution.

Let's save the result and get on with the challenge!

```{r}
geojsonio::geojson_write(input = r_buff, file = "r_buf.geojson")
```

## References

Lovelace, R., Goodman, A., Aldred, R., Berkoff, N., Abbas, A., Woodcock, J., 2016. The Propensity to Cycle Tool: An open source online system for sustainable transport planning. Journal of Transport and Land Use 10. doi:10.5198/jtlu.2016.862