nptscot / npt

Data processing code, also use this repo for issue tracking for the Network Planning Tool. See https://nptscot.github.io for development version
https://www.npt.scot/
GNU Affero General Public License v3.0
5 stars 0 forks source link

Cycle infra generation code misses parts of Princes Street #442

Closed Robinlovelace closed 2 months ago

Robinlovelace commented 2 months ago

As shown below:

image

Relevant code:

https://github.com/nptscot/npt/blob/4dd81c85a52d2c1f9d4909241d5d736137e0f03f/code/tests/cycling-by-design-tests.qmd#L909

Robinlovelace commented 2 months ago

This is now fixed, as shown below:

image

Source: https://github.com/nptscot/osmactive/releases/download/v0.1/cycle_network_classified_edinburgh.html

Source code:

remotes::install_github("nptscot/osmactive")
library(osmactive)
edinburgh = zonebuilder::zb_zone("Edinburgh")
edinburgh_3km = edinburgh |>
  # Change number in next line to change zone size:
  filter(circle_id <= 2) |>
  sf::st_union()
osm = get_travel_network("Scotland", boundary = edinburgh_3km, boundary_type = "clipsrc")
cycle_network = get_cycling_network(osm)
driving_network = get_driving_network_major(osm)
cycle_network_with_distance = distance_to_road(cycle_network, driving_network)
cycle_network_classified = classify_cycle_infrastructure(cycle_network_with_distance)
m = plot_osm_tmap(cycle_network_classified)
m

Save an interactive version of the map to check the results as follows:

#| eval: false
#| echo: false
tmap_save(m, "cycle_network_classified_edinburgh.html")
browseURL("cycle_network_classified_edinburgh.html")
system("gh release create v0.1", intern = TRUE)
system("gh release upload v0.1 cycle_network_classified_edinburgh.html", intern = TRUE)