Skip to contents

Generating cohesive cycling network

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,
  group_column = "name_1",
  max_path_weight = 10
)

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.

group_column

The column name to group the network by edge betweenness, default is "name_1".

max_path_weight

Maximum weight allowed for paths in network calculations, default is 10.

Value

A spatial object representing the largest cohesive component of the network, free of dangles.

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"))
#> Aggregating attribute: 'all_fastest_bicycle_go_dutch' using function: 'sum'.
#> [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)
#> Warning: st_centroid assumes attributes are constant over geometries
#> Warning: attribute variables are assumed to be spatially constant throughout all geometries
#> Column 'name_1' does not exist in unique_centroids.
#> Warning: Overwriting column(s): from
#> Warning: Overwriting column(s): to
#> Checking if spatial network structure is valid...
#> Spatial network structure is valid