-
Notifications
You must be signed in to change notification settings - Fork 2
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
Efficiently break-up network #54
Comments
He's a reproducible example showing it working with the new stplanr function - a bit slow: # Aim: test breaking-up long linestrings
library(sf)
library(stars)
library(dplyr)
rnet = pct::get_pct_rnet("hereford-and-worcester")
rnet$length = as.numeric(sf::st_length(rnet))
summary(rnet$length)
rnet = sf::st_transform(rnet, 27700)
r = raster::raster(rnet, resolution = 500)
raster::values(r) = 1
rast_template_polys = r %>% stars::st_as_stars() %>% sf::st_as_sf(as_points = FALSE)
rast_template_polys
system.time({
rnet_updated = trafficalmr::osm_consolidate(rnet, segment = 500)
})
rnet_long = rnet %>% filter(length > 1000)
summary(rnet_long$length)
system.time({
rnet_updated = stplanr::line_breakup(l = rnet_long, z = rast_template_polys)
})
summary(st_length(rnet_updated)) |
Update: using multithreaded code documented here r-spatial/qgisprocess#26 |
Multithreaded implementation in GRASS via the qgisprocess package did it in 5 minutes for the national route network. Details: https://github.com/saferactive/saferactive/blob/master/code/tests/line_breakup_qgis.R#L92 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We already have code to break up bits on the OSM network but this fails for the rnet use case:
Created on 2020-10-27 by the reprex package (v0.3.0)
Challenge: starting with the rnet object above, efficiently break up any lines over 500m.
Implementation based on new stplanr code is quite slow.
The text was updated successfully, but these errors were encountered: