Generating cohesive cycling network
corenet.Rd
This function processes the provided network data to identify and analyze significant routes based on a percentile threshold. It performs spatial operations, clusters data points, and calculates the largest network component without dangles, aiming to develop a cohesive cycling network infrastructure.
Usage
corenet(
influence_network,
cohesive_base_network,
target_zone,
key_attribute = "all_fastest_bicycle_go_dutch",
crs = "EPSG:27700",
npt_threshold = 1500,
maxDistPts = 1500,
minDistPts = 2,
road_scores = list(`A Road` = 1, `B Road` = 1, `Minor Road` = 1000),
n_removeDangles = 6,
penalty_value = 1
)
Arguments
- influence_network
The NPT network data, class 'sf'.
- cohesive_base_network
Spatial object representing the cohesive base network obtained via function cohesive_network_prep, class 'sf'.
- target_zone
Spatial object representing the study area or target zone, class 'sf'.
- key_attribute
Attribute used to determine significant network routes, default is "all_fastest_bicycle_go_dutch".
- crs
Coordinate reference system for transformation, default is "EPSG:27700".
- npt_threshold
Threshold value for filtering the NPT network, default is 1500.
- maxDistPts
Distance threshold used in path calculations, default is 1500 meters.
- minDistPts
Minimum distance threshold used in path calculations, default is 2 meters.
- road_scores
A list of road types and their corresponding scoring weights.
- n_removeDangles
Number of iterations to remove dangles from the network, default is 6.
- penalty_value
The penalty value for roads with low values, default is 1.
Examples
library(sf)
library(dplyr)
library(dbscan)
#>
#> Attaching package: ‘dbscan’
#> The following object is masked from ‘package:stats’:
#>
#> as.dendrogram
library(zonebuilder)
# Load demo data
os_edinburgh_demo_3km = sf::st_set_crs(os_edinburgh_demo_3km, 27700)
NPT_demo_3km = sf::st_set_crs(NPT_demo_3km, 27700)
base_network = sf::st_transform(os_edinburgh_demo_3km, crs = 27700)
influence_network = sf::st_transform(NPT_demo_3km, crs = 27700)
target_zone = zonebuilder::zb_zone("Edinburgh", n_circles = 2) |>
sf::st_transform(crs = "EPSG:27700")
# Execute the function
OS_NPT_demo = cohesive_network_prep( base_network = base_network,
influence_network = influence_network,
target_zone = target_zone,
key_attribute = "road_function",
crs = "EPSG:27700",
attribute_values = c("A Road", "B Road", "Minor Road"))
#> Requested number of segments (45185) does not match the number of segments returned by rsgeo (44530).
#> Warning: st_centroid assumes attributes are constant over geometries
#> Joining with `by = join_by(road_function)`
#> [1] "Finished preparing the network data"
OS_NPT_demo$geometry = OS_NPT_demo$geom
coherent_network = corenet(influence_network = OS_NPT_demo,
cohesive_base_network = OS_NPT_demo,
target_zone = target_zone,
key_attribute = "all_fastest_bicycle_go_dutch",
crs = "EPSG:27700",npt_threshold = 1500,maxDistPts = 1500,minDistPts = 2,
road_scores = list("A Road" = 1, "B Road" = 1, "Minor Road" = 1000),n_removeDangles = 6,penalty_value = 1)
#> Requested number of segments (5620) does not match the number of segments returned by rsgeo (5505).
#> Warning: st_centroid assumes attributes are constant over geometries
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries
#> Warning: Overwriting column(s): from
#> Warning: Overwriting column(s): to
#> Checking if spatial network structure is valid...
#> Spatial network structure is valid