Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nov 2024 build #550

Merged
merged 34 commits into from
Dec 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
6184824
2024 Nov Build
wangzhao0217 Nov 4, 2024
52dc0ac
add route ids
wangzhao0217 Nov 5, 2024
6661ad2
Manually update route_ids, speed things up
Robinlovelace Nov 5, 2024
17b2c43
add route id from zw
wangzhao0217 Nov 6, 2024
ad4f0c6
fix typo in route_ids.csv
wangzhao0217 Nov 6, 2024
e5d67f2
pre processing os by adding osm orcp
wangzhao0217 Nov 6, 2024
0648059
Update route_ids for Glasgow
Robinlovelace Nov 7, 2024
a0c6876
Update gitignore
Robinlovelace Nov 7, 2024
61ac56b
Update route_ids.csv
Robinlovelace Nov 7, 2024
d6fac91
More utility trips
Robinlovelace Nov 7, 2024
e8c224f
Updates with final routes
Robinlovelace Nov 7, 2024
131b8a2
Debugging error
Robinlovelace Nov 7, 2024
ca20e19
Debugging simplify network, speed things up
Robinlovelace Nov 7, 2024
f4cb888
Tidy up
Robinlovelace Nov 7, 2024
b199c9e
Full build for Glasgow again
Robinlovelace Nov 7, 2024
3f2a167
Tweak simplify_network bit
Robinlovelace Nov 7, 2024
ce1e978
Fix simplified network
Robinlovelace Nov 8, 2024
b27e54a
fix UNCLOSED_STRING error in the rs_commute_quietest
wangzhao0217 Nov 19, 2024
7f94edf
update traffic results and save CN as gpkg (#554)
wangzhao0217 Nov 27, 2024
7dfa7e9
apply robin's suggestion
wangzhao0217 Nov 27, 2024
f65cd09
Update final_traffic
wangzhao0217 Nov 27, 2024
b1f32e7
Update _targets.R
wangzhao0217 Nov 27, 2024
c13f93f
Use newer version of traffic data
Robinlovelace Nov 27, 2024
80011f8
Do not force osm download every time
Robinlovelace Nov 27, 2024
cea2fab
Update cbd_layer traffic categories, see https://github.com/nptscot/n…
Robinlovelace Nov 28, 2024
19d85c4
Update traffic volume categorisation code
Robinlovelace Nov 28, 2024
8704d08
update oute_ids.csv
wangzhao0217 Nov 28, 2024
14fa73a
update route id
wangzhao0217 Nov 28, 2024
ca6e499
Update boundaries, to low water mark definition (#556)
Robinlovelace Nov 28, 2024
cdeb34d
update route ids
wangzhao0217 Nov 28, 2024
9619e8b
Fix lads (#557)
Robinlovelace Nov 28, 2024
f5c1d55
set nov
wangzhao0217 Nov 28, 2024
762ad14
remove line cause problem
wangzhao0217 Nov 29, 2024
f3f2e83
Merge branch 'main' into Nov-2024-build
wangzhao0217 Dec 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions code/tests/simplified_network_test.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,84 @@ library(foreach)
library(iterators)
library(parallel)
library(doParallel)
library(mapview)
tar_source()
```


```{r}
# get off road from osm to os, simple combine
zone = zonebuilder::zb_zone("Edinburgh", n_circles = 3) |> sf::st_transform(crs = "EPSG:27700")

os_file_path = "inputdata/open_roads_scotland.gpkg"
os_scotland = sf::read_sf(os_file_path)
sf::st_geometry(os_scotland) = "geometry"

os_scotland = os_scotland[sf::st_union(zone), , op = sf::st_within]

osm_file_path = "inputdata/connectivity_fixed_osm.gpkg"
osm_scotland = sf::read_sf(osm_file_path)
sf::st_geometry(osm_scotland) = "geometry"

osm_scotland = osm_scotland[sf::st_union(zone), , op = sf::st_within]

os_scotland = os_scotland |> sf::st_transform(crs = "EPSG:27700") |> dplyr::select(geometry)
osm_scotland = osm_scotland |> sf::st_transform(crs = "EPSG:27700")

rnet_merged_all_geos = geos::as_geos_geometry(os_scotland)

rnet_merged_all_geos_buffer = geos::geos_buffer(rnet_merged_all_geos, distance = 30, params = geos::geos_buffer_params(quad_segs = 4))

rnet_merged_all_projected_buffer = sf::st_as_sf(rnet_merged_all_geos_buffer)

osm_scotland_subset = osm_scotland[sf::st_union(rnet_merged_all_projected_buffer), , op = sf::st_within]

osm_scotland_rest = osm_scotland[!osm_scotland$geometry %in% osm_scotland_subset$geometry, ]

os_scotland = dplyr::bind_rows(osm_scotland_rest, os_scotland)
```

```{r}
parameters = jsonlite::read_json("parameters.json", simplifyVector = T)
lads = sf::read_sf("inputdata/boundaries/la_regions_2023.geojson")
# To test for a single local authority:
# lads = lads |> filter(LAD23NM %in% c("City of Edinburgh", "Clackmannanshire"))
date_folder = parameters$date_routing
la_names = lads$LAD23NM
output_folder = file.path("outputdata", date_folder)
la_names_lowercase = snakecase::to_snake_case(la_names)
```

```{r}
la_name = la_names[1]
for (la_name in la_names) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

message("Processing la_name: ", la_name)
la_name_lowercase = snakecase::to_snake_case(la_name)
lads_la_name = lads |> filter(LAD23NM == la_name)
os_scotland_la_name = os_scotland[sf::st_union(lads_la_name), , op = sf::st_intersects]
# save os_scotland_la_name
Comment on lines +65 to +71
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this bit go into the #548 PR tho?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can do, but this code just need for once

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

os_scotland_la_name_f = file.path("inputdata", paste0("os_", la_name_lowercase, "_osm_orcp.geojson"))

sf::st_write(os_scotland_la_name, os_scotland_la_name_f, delete_dsn = T)
}
```

```{r}
region_snake_case = snakecase::to_snake_case(region_names[1])
base_name = paste0("OS_Scotland_Network_", region_snake_case, ".geojson")
rnet_x_f = file.path("inputdata", base_name)
rnet_x = sf::read_sf(rnet_x_f) |> sf::st_transform(crs = "EPSG:27700")

osm_file_path = "inputdata/connectivity_fixed_osm.gpkg"
osm_scotland = sf::read_sf(osm_file_path)
sf::st_geometry(osm_scotland) = "geometry"



```


```{r}
zone = zonebuilder::zb_zone("Edinburgh", n_circles = 3) |> sf::st_transform(crs = "EPSG:27700")
rnet_edingburgh = sf::st_read("outputdata/2024-11-01/edinburgh_and_lothians/combined_network_tile.geojson") |> sf::st_transform(crs = "EPSG:27700")
rnet_edingburgh_zone = rnet_edingburgh[sf::st_union(zone), , op = sf::st_intersects]
Expand Down