Created
February 6, 2026 11:58
-
-
Save szechno/911b51598bb66b157650d43992e255af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(sf) | |
| library(dplyr) | |
| library(readr) | |
| library(tidyr) | |
| library(tidygraph) | |
| library(sfnetworks) | |
| library(stplanr) | |
| library(stringr) | |
| library(purrr) | |
| library(mapview) | |
| ################################################################################ | |
| # | |
| # Feb 2026 | |
| # | |
| ################################################################################ | |
| source("00_functions_walking_routes_all_schools.R") | |
| # sf | |
| # read in district ---- | |
| wsx <- st_read("D:/data_store/Boundaries/county/county.shp") |> | |
| select(geometry) | |
| # create roads from osm_extract ---- | |
| # wsx_roads <- get_oemextract() | |
| # write_rds(school_roads, | |
| # "./rds/school_roads_england-latest.osm.pbf-2026-02-06.rds") | |
| # or read in existing... | |
| # wsx_roads <- read_rds( | |
| # "./rds/school_roads_england-latest.osm.pbf-2026-02-06.rds" | |
| # ) | |
| # sfnetwork | |
| # create sfnetwork from wsx_roads ---- | |
| # alt: | |
| # roads_clean <- make_sfnetwork(wsx_roads) | |
| # write_rds(roads_clean, | |
| # paste0("./rds/roads_clean_", Sys.Date(), ".rds")) | |
| roads_clean <- read_rds("./rds/roads_clean_2026-02-06.rds") | |
| # sf | |
| # read in pupils ---- | |
| # "nativeid" '0000' "geometry" | |
| pupils <- read_rds("./rds/pupils_wsx.rds") | |
| # sf | |
| # read in schools shapefile ---- | |
| schools <- read_rds("./rds/schools_wsx_preferred.rds") | |
| # run all ---- | |
| schools_list <- schools_list() | |
| a <- map(1:10, \(x) make_school_routes(id = schools_list[[x]]), | |
| .progress = TRUE) |> | |
| bind_rows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment