Skip to content

Commit

Permalink
matching geocodes
Browse files Browse the repository at this point in the history
  • Loading branch information
joeytalbot committed Dec 12, 2022
1 parent ef34c31 commit 5174776
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions code/censusdata.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ library(tmap)
library(tidyverse)
tmap_mode("view")

northeast = get_pct_zones("north-east")
northeast = get_pct_zones("north-east", geography = "msoa")
tyneandwear = northeast %>%
filter(lad_name == "Newcastle upon Tyne" | lad_name == "Sunderland" |
lad_name == "Gateshead" | lad_name == "North Tyneside" |
Expand All @@ -27,17 +27,20 @@ lines_tyneandwear = lines %>%
)
tm_shape(lines_tyneandwear) + tm_lines()

lines_foot = lines_tyneandwear %>%
lines_matching = lines_tyneandwear %>%
filter(geo_code1 %in% northeast$geo_code & geo_code2 %in% northeast$geo_code)

lines_foot = lines_matching %>%
filter(foot > 0) %>%
# select(-c(car_driver:ebike_sico2), -bicycle) %>%
select(geo_code1, geo_code2, foot)

lines_bicycle = lines_tyneandwear %>%
lines_bicycle = lines_matching %>%
filter(bicycle > 0) %>%
# select(-c(foot:ebike_sico2)) %>%
select(geo_code1, geo_code2, bicycle)

lines_car = lines_tyneandwear %>%
lines_car = lines_matching %>%
filter(car_driver > 0) %>%
# select(-bicycle, -foot, -c(govtarget_slc:ebike_sico2)) %>%
select(geo_code1, geo_code2, car_driver)
Expand All @@ -46,7 +49,7 @@ lines_car = lines_tyneandwear %>%
# Unjittered routes ------------------------------------------------------

library(stplanr)
# coords = od_coords(lines_tyneandwear)
# coords = od_coords(lines_matching)
# from = coords[, 1:2]
# to = coords[, 3:4]
# routes_osrm = route_osrm(from = from, to = to, osrm.profile = "foot") # not working]
Expand Down Expand Up @@ -120,6 +123,7 @@ od_car_jittered = odjitter::jitter(
min_distance_meters = min_distance_meters
)

saveRDS(od_car_jittered, "data/od_car_jittered.Rds")

# Route networks ----------------------------------------------------------

Expand Down

0 comments on commit 5174776

Please sign in to comment.