Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ITSLeeds/pctCorridors
Place to extract estimates of potential cycling levels along 'corridors' - clusters of origin and destination zones
https://github.com/ITSLeeds/pctCorridors
Last synced: 3 months ago
JSON representation
Place to extract estimates of potential cycling levels along 'corridors' - clusters of origin and destination zones
- Host: GitHub
- URL: https://github.com/ITSLeeds/pctCorridors
- Owner: ITSLeeds
- Created: 2019-02-20T16:49:31.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T13:30:50.000Z (over 5 years ago)
- Last Synced: 2024-05-14T15:36:11.440Z (6 months ago)
- Size: 2.93 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
README
---
output: github_document
---```{r}
# set-up:
# get data from: http://wicid.ukdataservice.ac.uk/cider/wicid/downloads.php
library(tidyverse)
library(stplanr)
library(sf)
library(tmap)
ttm()
```Aim: Plot from the MSOAs below as origins, through to Bradford 039 (E02002221):
Input data:
```{r}
unzip("wu02ew_v2.zip")
od_all = read_csv("wu02ew_v2.csv")
``````{r}
zones_origin = c("E02002197",
"E02002204",
"E02002200",
"E02002202",
"E02002207",
"E02002216"
)
zones_destination = "E02002221"
od_all_small = od_all %>%
filter(`Area of residence` %in% zones_origin &
`Area of workplace` %in% zones_destination
)
``````{r}
z = read_sf("https://github.com/npct/pct-outputs-regional-notR/raw/master/commute/msoa/west-yorkshire/z.geojson")
desire_lines = od2line(flow = od_all_small, z)
desire_lines$distance = as.numeric(st_length(desire_lines)) / 1000
mapview::mapview(desire_lines, zcol = "All categories: Age 16 and over")
# tm_shape(desire_lines) +
# tm_lines(col = "All categories: Age 16 and over")
d = desire_lines %>%
select(
`Area of workplace`,
commutes = `All categories: Age 16 and over`,
distance) %>%
st_drop_geometry()
knitr::kable(d)sum(d$commutes)
```Result: http://rpubs.com/RobinLovelace/470831