| Title: | Urban Walkability and Active Transit Network Analysis |
|---|---|
| Description: | High-performance geospatial graph analysis for urban street networks, walkability, and active mobility. Features topological diagnostics and controlled repair for user-provided networks, street-network acquisition from 'OpenStreetMap', multi-threaded Rust kernels for isochrone-based reachable-network length metrics with partial-edge credits, and publication-ready 'ggplot2' visualizations. The accessibility measures draw on Hansen (1959) <doi:10.1080/01944365908978307>; street-network analysis follows Boeing (2017) <doi:10.1016/j.compenvurbsys.2017.05.004>; and betweenness centrality follows Freeman (1977) <doi:10.2307/3033543>. |
| Authors: | Paul E. Santos Andrade [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-6635-0375>) |
| Maintainer: | Paul E. Santos Andrade <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-11-17 15:38:50 UTC |
| Source: | https://github.com/cran/walkability |
Converts a walk_network object into an sfnetwork from the sfnetworks package
for seamless integration with spatial graph routing and tidygraph analysis workflows.
as_sfnetwork(x, ...) ## S3 method for class 'walk_network' as_sfnetwork(x, directed = FALSE, ...)as_sfnetwork(x, ...) ## S3 method for class 'walk_network' as_sfnetwork(x, directed = FALSE, ...)
x |
A |
... |
Additional arguments passed to methods. |
directed |
Logical. If |
An sfnetwork object if sfnetworks is installed.
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) if (requireNamespace("sfnetworks", quietly = TRUE)) { sfn <- as_sfnetwork(net) print(sfn) }data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) if (requireNamespace("sfnetworks", quietly = TRUE)) { sfn <- as_sfnetwork(net) print(sfn) }
Converts a walk_network object into a tbl_graph from the tidygraph package.
as_tidygraph(x, ...) ## S3 method for class 'walk_network' as_tidygraph(x, directed = FALSE, ...)as_tidygraph(x, ...) ## S3 method for class 'walk_network' as_tidygraph(x, directed = FALSE, ...)
x |
A |
... |
Additional arguments passed to methods. |
directed |
Logical. If |
A tbl_graph object if tidygraph is installed.
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) if (requireNamespace("tidygraph", quietly = TRUE)) { tg <- as_tidygraph(net) print(tg) }data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) if (requireNamespace("tidygraph", quietly = TRUE)) { tg <- as_tidygraph(net) print(tg) }
Visualizes the spatial distribution of accessible facilities from each intersection.
## S3 method for class 'walk_access' plot(x, category = NULL, ...)## S3 method for class 'walk_access' plot(x, category = NULL, ...)
x |
A |
category |
Character string of the category to display (if multiple exist). |
... |
Additional arguments. |
A ggplot object.
Plot Method for Walk Betweenness
## S3 method for class 'walk_betweenness' plot(x, ...)## S3 method for class 'walk_betweenness' plot(x, ...)
x |
A |
... |
Additional arguments. |
A ggplot object.
Visualizes the closed streets in red alongside the difference in reachable pedestrian length.
## S3 method for class 'walk_comparison' plot(x, ...)## S3 method for class 'walk_comparison' plot(x, ...)
x |
A |
... |
Additional arguments. |
A ggplot object.
Visualizes disconnected network components and potential undershoots.
## S3 method for class 'walk_diagnosis' plot(x, ...)## S3 method for class 'walk_diagnosis' plot(x, ...)
x |
A |
... |
Additional arguments passed to ggplot2. |
A ggplot object.
Visualizes multi-threshold isochrone polygons with layered fills.
## S3 method for class 'walk_isochrone' plot(x, show_network = TRUE, ...)## S3 method for class 'walk_isochrone' plot(x, show_network = TRUE, ...)
x |
A |
show_network |
Logical. If |
... |
Additional arguments. |
A ggplot object.
Visualizes the spatial layout of cul-de-sacs, T-junctions, and crossroads.
## S3 method for class 'walk_morphology' plot(x, ...)## S3 method for class 'walk_morphology' plot(x, ...)
x |
A |
... |
Additional arguments. |
A ggplot object.
Visualizes the shortest pedestrian path overlaid on the local street network.
## S3 method for class 'walk_path' plot(x, network = NULL, ...)## S3 method for class 'walk_path' plot(x, network = NULL, ...)
x |
A |
network |
Optional background |
... |
Additional arguments. |
A ggplot object.
Plot Method for Walk Reach Object
## S3 method for class 'walk_reach' plot(x, ...)## S3 method for class 'walk_reach' plot(x, ...)
x |
A |
... |
Additional arguments passed to |
A ggplot object.
Print Method for Walk Access
## S3 method for class 'walk_access' print(x, ...)## S3 method for class 'walk_access' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_access object x, invisibly, after printing its summary.
Print Method for Walk Betweenness
## S3 method for class 'walk_betweenness' print(x, ...)## S3 method for class 'walk_betweenness' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_betweenness object x, invisibly, after printing its summary.
Print Method for Walk Comparison
## S3 method for class 'walk_comparison' print(x, ...)## S3 method for class 'walk_comparison' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_comparison object x, invisibly, after printing its summary.
Print Method for Street Network Diagnosis
## S3 method for class 'walk_diagnosis' print(x, ...)## S3 method for class 'walk_diagnosis' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_diagnosis object x, invisibly, after printing its summary.
Print Method for Walk Isochrone
## S3 method for class 'walk_isochrone' print(x, ...)## S3 method for class 'walk_isochrone' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_isochrone object x, invisibly, after printing its summary.
Print Method for Walk Morphology
## S3 method for class 'walk_morphology' print(x, ...)## S3 method for class 'walk_morphology' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_morphology object x, invisibly, after printing its summary.
Print Method for Walk Network
## S3 method for class 'walk_network' print(x, ...)## S3 method for class 'walk_network' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_network object x, invisibly, after printing its summary.
Print Method for Walk Path
## S3 method for class 'walk_path' print(x, ...)## S3 method for class 'walk_path' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_path object x, invisibly, after printing its summary.
Print Method for Walk Reach Metric
## S3 method for class 'walk_reach' print(x, ...)## S3 method for class 'walk_reach' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_reach object x, invisibly, after printing its summary.
Print Method for Walk Scenario Betweenness
## S3 method for class 'walk_scenario_betweenness' print(x, ...)## S3 method for class 'walk_scenario_betweenness' print(x, ...)
x |
A |
... |
Additional arguments. |
The walk_scenario_betweenness object x, invisibly, after printing its summary.
Build Compressed Sparse Row (CSR) graph representation. Drops self-loops, collapses parallel edges to minimum travel time, and returns CSR structures along with connected component analysis.
rust_build_csr(n_nodes, u, v, wt, wl)rust_build_csr(n_nodes, u, v, wt, wl)
n_nodes |
Number of nodes in the graph (0-indexed: 0..n-1). |
u |
From-node vector (0-indexed). |
v |
To-node vector (0-indexed). |
wt |
Travel time in seconds for each edge. |
wl |
Physical length in meters for each edge. |
A named list containing CSR arrays head, to, wt, and wl; node component IDs comp; and graph summaries n_edges_collapsed, giant_comp_id, giant_comp_size, and total_components. Node and component IDs are zero based.
Compute cumulative POI accessibility for target nodes in parallel.
rust_compute_access_multi( n_nodes, head_num, to, wt, target_nodes, poi_nodes, poi_weights, cutoff, num_threads )rust_compute_access_multi( n_nodes, head_num, to, wt, target_nodes, poi_nodes, poi_weights, cutoff, num_threads )
n_nodes |
Total number of nodes. |
head_num |
CSR head array. |
to |
CSR destination array. |
wt |
CSR travel time array (seconds). |
target_nodes |
Indices of nodes to compute accessibility for (0-indexed). |
poi_nodes |
Vector of node indices where POIs are situated. |
poi_weights |
Vector of weights/counts for each POI node. |
cutoff |
Travel time cutoff in seconds. |
num_threads |
Number of worker threads (1 or 2; values outside this range are clamped to the supported range by the native implementation). |
A named list with numeric accessible_count and min_time_s vectors, one element per target node. These give weighted reachable POI counts and travel time in seconds to the nearest reachable POI, respectively.
Circuity is defined as actual network shortest path distance divided by Euclidean straight-line distance. Values close to 1.0 indicate highly direct routes; higher values indicate circuitous paths and poor permeability.
rust_compute_circuity_sample( n_nodes, head_num, to, wt, wl, coords_x, coords_y, sample_nodes, cutoff )rust_compute_circuity_sample( n_nodes, head_num, to, wt, wl, coords_x, coords_y, sample_nodes, cutoff )
n_nodes |
Total number of nodes. |
head_num |
CSR head array. |
to |
CSR destination array. |
wt |
CSR travel time array. |
wl |
CSR length array. |
coords_x |
Vector of node X coordinates (meters). |
coords_y |
Vector of node Y coordinates (meters). |
sample_nodes |
Nodes from which to measure circuity. |
cutoff |
Travel time cutoff in seconds. |
A named list with node_id, mean_circuity, max_circuity, and destinations_reached vectors. Each position summarizes the network to straight-line distance ratios for one sampled origin.
Compute reachable walkable network length in parallel for a set of target nodes.
rust_compute_reachable_length( n_nodes, head_num, to, wt, wl, target_nodes, cutoff, num_threads )rust_compute_reachable_length( n_nodes, head_num, to, wt, wl, target_nodes, cutoff, num_threads )
n_nodes |
Total number of nodes in graph. |
head_num |
CSR head array. |
to |
CSR destination nodes. |
wt |
CSR travel times (seconds). |
wl |
CSR lengths (meters). |
target_nodes |
Indices of nodes to compute metric for (0-indexed). |
cutoff |
Walk travel-time budget (seconds, default 600.0 = 10 min). |
num_threads |
Number of worker threads (1 or 2; values outside this range are clamped to the supported range by the native implementation). |
A numeric vector, one value per target_nodes entry, giving reachable street length in meters within cutoff. Invalid target nodes yield NaN.
Extract reachable edges and nodes within cutoff time from an origin node.
rust_isochrone_subgraph(n_nodes, head_num, to, wt, wl, src_node, cutoff)rust_isochrone_subgraph(n_nodes, head_num, to, wt, wl, src_node, cutoff)
n_nodes |
Total number of nodes. |
head_num |
CSR head array. |
to |
CSR destination array. |
wt |
CSR travel time array (seconds). |
wl |
CSR length array (meters). |
src_node |
Origin node (0-indexed). |
cutoff |
Travel time cutoff in seconds. |
A named list with reached_nodes and their node_times, plus edge_from, edge_to, edge_fraction, edge_length, and edge_reached_length describing reachable portions of street edges. Node IDs are zero based, times are seconds, and lengths are meters.
Compute shortest path between source and target nodes using Dijkstra.
rust_shortest_path(n_nodes, head_num, to, wt, wl, src_node, dst_node)rust_shortest_path(n_nodes, head_num, to, wt, wl, src_node, dst_node)
n_nodes |
Total number of nodes. |
head_num |
CSR head array. |
to |
CSR destination array. |
wt |
CSR travel time array (seconds). |
wl |
CSR length array (meters). |
src_node |
Origin node (0-indexed). |
dst_node |
Destination node (0-indexed). |
A named list with logical found, zero-based node_path and edge_indices vectors, and numeric total_time_s and total_length_m. When no path is found, paths are empty and totals are NaN.
A spatial sf line dataset representing the walkable street network of the
Historic Center, Plaza de Armas, and Yanahuara in Arequipa, Peru. Extracted from
OpenStreetMap and projected into UTM Zone 19S (EPSG:32719).
streets_arequipastreets_arequipa
An sf data frame with LINESTRING geometries and columns:
Unique integer identifier for each street segment.
Original OpenStreetMap way identifier.
Street or passage name (if available).
OpenStreetMap road classification (e.g. pedestrian, footway, residential, tertiary).
Directionality tag from OSM.
Pavement surface type.
LineString geometry in EPSG:32719.
OpenStreetMap contributors (https://www.openstreetmap.org/copyright), ODbL 1.0.
data(streets_arequipa) nrow(streets_arequipa)data(streets_arequipa) nrow(streets_arequipa)
A spatial sf line dataset representing the walkable street network of the
Historic Center and San Blas district in Cusco, Peru. Extracted from
OpenStreetMap and projected into UTM Zone 19S (EPSG:32719).
streets_cuscostreets_cusco
An sf data frame with LINESTRING geometries and columns:
Unique integer identifier for each street segment.
Original OpenStreetMap way identifier.
Street or passage name (if available).
OpenStreetMap road classification (e.g. pedestrian, footway, residential, steps).
Directionality tag from OSM.
Pavement surface type (e.g. paved, cobblestone).
LineString geometry in EPSG:32719.
OpenStreetMap contributors (https://www.openstreetmap.org/copyright), ODbL 1.0.
data(streets_cusco) nrow(streets_cusco)data(streets_cusco) nrow(streets_cusco)
A spatial sf line dataset representing the walkable street network of the
Historic Center and Damero de Pizarro in Lima, Peru. Extracted from
OpenStreetMap and projected into UTM Zone 18S (EPSG:32718).
streets_limastreets_lima
An sf data frame with LINESTRING geometries and columns:
Unique integer identifier for each street segment.
Original OpenStreetMap way identifier.
Street or passage name (if available).
OpenStreetMap road classification (e.g. pedestrian, footway, residential, secondary).
Directionality tag from OSM.
Pavement surface type.
LineString geometry in EPSG:32718.
OpenStreetMap contributors (https://www.openstreetmap.org/copyright), ODbL 1.0.
data(streets_lima) nrow(streets_lima)data(streets_lima) nrow(streets_lima)
Clean theme optimized for geospatial network visualizations with ggplot2.
theme_walkability(base_size = 11, base_family = "", dark = TRUE)theme_walkability(base_size = 11, base_family = "", dark = TRUE)
base_size |
Base font size. |
base_family |
Base font family. |
dark |
Logical. If |
A ggplot2 theme object that styles plot backgrounds, text, and legends for walkability maps.
Launches an interactive web application built with Shiny, bslib, and mapgl
(MapLibre GL JS) for visual exploration and quantitative analysis of urban
street networks.
walk_app( network = NULL, host = "127.0.0.1", port = NULL, launch.browser = TRUE, lang = c("es", "en"), ... )walk_app( network = NULL, host = "127.0.0.1", port = NULL, launch.browser = TRUE, lang = c("es", "en"), ... )
network |
Optional initial |
host |
Character. The IPv4 address that the application should listen on (default |
port |
Integer. The TCP port that the application should listen on. Default is randomly selected. |
launch.browser |
Logical. Whether to open the application in the system's default browser (default |
lang |
Character string specifying the initial interface language:
|
... |
Additional arguments passed to |
The application provides dedicated, fully documented workspaces for:
Pedestrian Reachability (10-min Reach): Spatial gradient of walkable network length with partial-edge credits in Rust.
Multi-Threshold Isochrones: Concentric, non-overlapping topological rings (e.g. 5, 10, 15 min) or cumulative hulls.
Point-to-Point Routing & Circuity: Optimal shortest path, travel time, and detour ratio.
Network Morphology & Intersection Density: Topological node valence classification (cul-de-sacs, 3-way, 4-way+).
Scenario Simulation: Testing street closures and pedestrianization with before/after comparison.
Documentation & Code Generator: Detailed methodology and reproducible R scripts.
Runs the Shiny application (returns invisible NULL).
if (interactive()) { # Launch with default language (Spanish): walk_app() # Launch in English: walk_app(lang = "en") # Launch with a pre-built network: utils::data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) walk_app(net, lang = "es") }if (interactive()) { # Launch with default language (Spanish): walk_app() # Launch in English: walk_app(lang = "en") # Launch with a pre-built network: utils::data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) walk_app(net, lang = "es") }
Computes the edge betweenness centrality for all street segments in a walkable network. Betweenness measures the proportion of potential shortest paths that traverse each street segment. A high value denotes a critical bridge, connector, or structural bottleneck: if interrupted, many potential routes are forced to divert.
walk_betweenness( network, snap_tolerance_m = 0, radius_m = NULL, weights = "length_m", directed = FALSE, normalized = TRUE )walk_betweenness( network, snap_tolerance_m = 0, radius_m = NULL, weights = "length_m", directed = FALSE, normalized = TRUE )
network |
A |
snap_tolerance_m |
Numeric. Radius in meters for network gap correction (snapping tolerance). If > 0, repairs unconnected endpoints before graph construction. Default is 0.0. |
radius_m |
Optional numeric. Maximum metric search radius (cutoff) for shortest paths.
If |
weights |
Character string naming the edge attribute used for path lengths. Default is |
directed |
Logical. If |
normalized |
Logical. If |
The betweenness centrality of an edge is defined as:
where is the total number of shortest paths from node to node ,
and is the number of those paths that pass through edge .
Important Methodological Note: Betweenness is a purely structural topological metric. It is not a traffic volume count (aforo) nor a congestion forecast. The tool does not assume vehicle volumes, origin-destination matrices, travel schedules, one-way regulations, or actual speeds. Consequently, high-betweenness (highlighted in red) street segments represent structural network priorities, but should not be conflated with "streets carrying the most traffic".
If snap_tolerance_m > 0, street segments with small digitization gaps or
undershoots within that metric tolerance are snapped and reconciled before calculating
shortest-path flow, avoiding artificial topological breaks.
A walk_betweenness S3 object containing:
edges |
|
summary |
Summary statistics of betweenness across the network. |
top_bottlenecks |
Top street segments with highest betweenness. |
network |
The evaluated |
snap_tolerance_m |
The snapping tolerance used. |
radius_m |
The cutoff radius used. |
if (requireNamespace("igraph", quietly = TRUE)) { data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) bw <- walk_betweenness(net) print(bw) }if (requireNamespace("igraph", quietly = TRUE)) { data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) bw <- walk_betweenness(net) print(bw) }
Converts user-supplied or downloaded spatial street data into a clean, pedestrian-routing graph structure. Computes edge travel times at a constant walking speed, optionally performs geometric repairs (planarization, endpoint snapping) at the user's discretion, and prepares Compressed Sparse Row (CSR) topology via compiled Rust.
walk_build_network( data, crs = NULL, walk_speed_kmh = 4.5, repair = FALSE, planarize = FALSE, snap_tolerance_m = 0, keep_components = c("largest", "all"), drop_classes = c("motorway", "trunk"), drop_subclasses = TRUE, verbose = TRUE )walk_build_network( data, crs = NULL, walk_speed_kmh = 4.5, repair = FALSE, planarize = FALSE, snap_tolerance_m = 0, keep_components = c("largest", "all"), drop_classes = c("motorway", "trunk"), drop_subclasses = TRUE, verbose = TRUE )
data |
An |
crs |
Optional target metric CRS (e.g. |
walk_speed_kmh |
Walking design speed in km/h (default is 4.5 km/h, the international pedestrian planning standard, approx. 1.25 m/s). |
repair |
Logical. If |
planarize |
Logical. If |
snap_tolerance_m |
Numeric. Threshold in meters to snap endpoint gaps. Default is 0.0 (no snapping). A value between 2.0 and 5.0 is recommended for imperfect street databases. |
keep_components |
Character. Either |
drop_classes |
Character vector of road classes to exclude (e.g. |
drop_subclasses |
Logical. If |
verbose |
Logical. If |
A walk_network S3 object containing:
nodes |
|
edges |
|
csr |
List with Compressed Sparse Row topology arrays ( |
walk_speed_kmh |
The walking speed used. |
giant_comp_id |
ID of the giant connected component. |
crs |
The coordinate reference system of the network. |
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) print(net)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) print(net)
Compares structural topology and reachable walkable network length between a baseline street network and an intervention scenario (e.g. street closures).
walk_compare_scenarios(base, scenario, time_min = 10, verbose = TRUE)walk_compare_scenarios(base, scenario, time_min = 10, verbose = TRUE)
base |
Baseline |
scenario |
Modified |
time_min |
Walking budget in minutes for reach comparison (default 10.0 min). |
verbose |
Logical. If |
A walk_comparison S3 object.
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) cierre <- walk_scenario_close(net, edge_indices = c(5, 12), name = "Peatonalizacion Central") comp <- walk_compare_scenarios(base = net, scenario = cierre, time_min = 5, verbose = FALSE) print(comp)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) cierre <- walk_scenario_close(net, edge_indices = c(5, 12), name = "Peatonalizacion Central") comp <- walk_compare_scenarios(base = net, scenario = cierre, time_min = 5, verbose = FALSE) print(comp)
Computes cumulative pedestrian accessibility from each network junction to urban facilities (e.g. schools, health centers, pharmacies, public transit stops) within a walking time budget (default 10 minutes at 4.5 km/h). Uses parallel compiled Rust to evaluate hundreds of thousands of shortest paths across CPU cores.
walk_compute_access( network, pois, time_min = 10, category_col = NULL, weight_col = NULL, target = c("largest_component", "all"), n_threads = 2L, verbose = TRUE )walk_compute_access( network, pois, time_min = 10, category_col = NULL, weight_col = NULL, target = c("largest_component", "all"), n_threads = 2L, verbose = TRUE )
network |
A |
pois |
An |
time_min |
Walking time threshold in minutes (default 10.0 minutes). |
category_col |
Optional column name in |
weight_col |
Optional column name in |
target |
Character string: |
n_threads |
Number of CPU threads to use in parallel, from 1 to 2. The default is 2, the maximum permitted during CRAN checks. |
verbose |
Logical. If |
A walk_access S3 object containing:
nodes |
|
summary |
Summary statistics table per category. |
time_min |
The evaluated walking budget in minutes. |
pois |
The original POI points mapped to network nodes. |
network |
The input |
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) sample_pois <- net$nodes[net$nodes$is_giant, ][seq(1, 100, by = 20), ] acc <- walk_compute_access(net, pois = sample_pois, time_min = 5, verbose = FALSE) print(acc)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) sample_pois <- net$nodes[net$nodes$is_giant, ][seq(1, 100, by = 20), ] acc <- walk_compute_access(net, pois = sample_pois, time_min = 5, verbose = FALSE) print(acc)
Evaluates path directness by comparing network shortest-path distances against Euclidean straight-line distances. High circuity signifies indirect, circuitous street patterns and cul-de-sacs.
walk_compute_circuity( network, sample_size = 500, time_min = 10, cutoff_s = NULL )walk_compute_circuity( network, sample_size = 500, time_min = 10, cutoff_s = NULL )
network |
A |
sample_size |
Number of random junctions to sample. Default is 500. |
time_min |
Walking time budget in minutes (default is 10.0 minutes). |
cutoff_s |
Optional walking time budget in seconds (default is |
A tibble with node IDs and calculated detour ratios.
Computes the total walkable network length lying within each node's isochrone (default 10-minute walk at 4.5 km/h, ~750 m budget). The calculation runs in parallel using compiled Rust and applies the exact partial-edge credit rule, crediting crossing frontier edges for only their reachable fraction.
walk_compute_reach( network, time_min = 10, cutoff_s = NULL, target = c("largest_component", "all"), n_threads = 2L, verbose = TRUE )walk_compute_reach( network, time_min = 10, cutoff_s = NULL, target = c("largest_component", "all"), n_threads = 2L, verbose = TRUE )
network |
A |
time_min |
Walking time budget in minutes (default is 10.0 minutes). Users can freely customize this parameter; for smaller neighborhoods, compact districts, or localized analyses, values like 5.0 or 7.5 minutes can be used. |
cutoff_s |
Optional walking time budget in seconds (e.g. 600.0). If specified,
it overrides |
target |
Character string. Either |
n_threads |
Number of CPU threads to use in parallel, from 1 to 2. The default is 2, the maximum permitted during CRAN checks. |
verbose |
Logical. If |
A walk_reach S3 object containing:
nodes |
|
edges |
|
summary |
Summary statistics (min, mean, max, 5th, 95th percentiles). |
time_min |
The time cutoff in minutes. |
cutoff_s |
The time cutoff in seconds. |
network |
The input |
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) reach <- walk_compute_reach(net, time_min = 5, verbose = FALSE) print(reach)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) reach <- walk_compute_reach(net, time_min = 5, verbose = FALSE) print(reach)
Evaluates the topological connectivity, dangling nodes, potential undershoots, and component fragmentation of a user-supplied street network before building the routing graph. This function does not alter geometries, leaving repair decisions to the user.
walk_diagnose_network(data, snap_search_radius_m = 10, crs = NULL)walk_diagnose_network(data, snap_search_radius_m = 10, crs = NULL)
data |
An |
snap_search_radius_m |
Maximum distance in meters to search for potential undershoots (unconnected ends located near another segment). Default is 10.0 meters. |
crs |
Optional target metric CRS (e.g. EPSG code or proj4string). If provided,
|
An undershoot occurs when a digitized street segment terminates just short
of intersecting or connecting with an adjacent road, leaving a small metric gap.
While legitimate dead ends (cul-de-sacs) naturally exist in pedestrian networks,
a dangling endpoint that lies suspiciously close (within snap_search_radius_m)
to another street is typically a digitization or vectorization defect.
In walk_diagnose_network(), undershoots are identified in two stages:
All dangling endpoints (nodes with topological degree = 1) are isolated across the network.
The minimum Euclidean distance from each dangling endpoint to all other line
geometries (excluding the incident segment itself) is computed. If this distance is
less than or equal to snap_search_radius_m, the endpoint is flagged as a
potential undershoot.
In pedestrian routing, even a gap of a few centimeters forms an impassable barrier,
artificially forcing detours or disconnecting origins from destinations. Potential
undershoots can be resolved during network construction via
walk_build_network(..., repair = TRUE, snap_tolerance_m = ...).
Isolated edges are street segments that belong to disconnected components (subgraphs or "islands") outside of the primary giant component (the largest contiguous connected network).
In walk_diagnose_network(), connectivity components are detected using a fast
disjoint-set (Union-Find) algorithm implemented in Rust:
Endpoints are matched across lines using coordinate coincidence with 1 mm precision.
The giant component is determined as the component with the largest total network length.
Any edge where neither endpoint connects to the giant component is labeled as an isolated edge.
Isolated fragments commonly arise from bounding box or polygon clipping (cutting streets at administrative borders), gated communities, or disjointed municipal data layers. When routing or computing isochrones, any origin or destination snapped to an isolated edge will be mathematically unreachable from the rest of the city (resulting in infinite travel times).
Diagnostic results can be inspected visually using plot(diagnosis) or
walk_plot_diagnosis(), which renders the giant component
in neutral tones, highlights isolated edges in red, and marks potential undershoots with amber points.
A walk_diagnosis S3 object containing:
summary |
Tibble with diagnostic statistics (segments, lengths, components, dangles, undershoots). |
components |
Table of detected connected components and their total lengths. |
undershoots |
|
isolated_edges |
|
data |
Original spatial line data. |
search_radius_m |
The search radius parameter used. |
walk_plot_diagnosis(), walk_build_network()
data(streets_cusco) diag <- walk_diagnose_network(streets_cusco, snap_search_radius_m = 5) print(diag)data(streets_cusco) diag <- walk_diagnose_network(streets_cusco, snap_search_radius_m = 5) print(diag)
Downloads walkable street networks using OpenStreetMap via the osmdata package.
walk_download_osm(place_name, buffer_m = 2000)walk_download_osm(place_name, buffer_m = 2000)
place_name |
Character. Geographic name to query (e.g. |
buffer_m |
Buffer distance in meters around the bounding box. Default is 2000 meters. |
An sf data frame with line geometries.
Evaluates the structural morphology of a walkable street network by analyzing node valence (degrees), isolating cul-de-sacs (dead ends), counting 3-way (T-junctions) and 4-way+ (crossroads) intersections, and calculating density metrics.
walk_intersection_density(network, study_area = NULL)walk_intersection_density(network, study_area = NULL)
network |
A |
study_area |
Optional |
A walk_morphology S3 object containing:
summary |
A named list of summary morphological metrics. |
nodes |
|
network |
The input |
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) morph <- walk_intersection_density(net) print(morph)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) morph <- walk_intersection_density(net) print(morph)
Generates spatial polygon isochrones (concave hulls or buffered envelopes) and extracts the exact reachable street network from an origin location for specified walking time budgets (e.g. 5, 10, 15 minutes).
walk_isochrone( network, origin, time_min = c(5, 10, 15), method = c("concave", "buffer"), buffer_m = 25, concave_ratio = 0.3, rings = TRUE )walk_isochrone( network, origin, time_min = c(5, 10, 15), method = c("concave", "buffer"), buffer_m = 25, concave_ratio = 0.3, rings = TRUE )
network |
A |
origin |
Origin location: an integer node ID, coordinate vector |
time_min |
Numeric vector of walking time thresholds in minutes
(e.g. |
method |
Polygon generation technique: |
buffer_m |
Buffer width in meters applied along reachable edges when synthesizing pedestrian walkable corridors (default 25.0 m). |
concave_ratio |
Ratio parameter passed to |
rings |
Logical. If |
A walk_isochrone S3 object containing:
polygons |
|
cumulative_polygons |
|
edges |
|
origin |
|
time_min |
The evaluated time thresholds. |
rings |
Logical indicating whether disjoint rings were generated. |
network |
The input |
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) orig <- sf::st_coordinates(net$nodes[net$nodes$is_giant, ])[1, 1:2] iso <- walk_isochrone(net, origin = orig, time_min = c(5, 10), rings = TRUE) print(iso)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) orig <- sf::st_coordinates(net$nodes[net$nodes$is_giant, ])[1, 1:2] iso <- walk_isochrone(net, origin = orig, time_min = c(5, 10), rings = TRUE) print(iso)
Maps the health of a street network, displaying the main connected component in neutral tones and highlighting isolated fragments and potential undershoots.
walk_plot_diagnosis( diagnosis, title = "Street Network Topological Health", dark = TRUE )walk_plot_diagnosis( diagnosis, title = "Street Network Topological Health", dark = TRUE )
diagnosis |
A |
title |
Optional custom title. |
dark |
Logical. If |
A ggplot object.
Generates a publication-grade cartographic visualization of reachable walkable
network length using ggplot2. Segments are rendered in ascending order so
dense, high-connectivity areas (yellow) plot on top. The color scale is clipped
to the 2nd-98th percentiles with saturation arrows for optimal visual contrast.
walk_plot_reach( reach, boundary = NULL, palette = "viridis", p_clip = c(0.02, 0.98), title = NULL, subtitle = NULL, line_width = 0.4, dark = TRUE )walk_plot_reach( reach, boundary = NULL, palette = "viridis", p_clip = c(0.02, 0.98), title = NULL, subtitle = NULL, line_width = 0.4, dark = TRUE )
reach |
A |
boundary |
Optional |
palette |
Palette name for |
p_clip |
Percentile range for color clipping (default |
title |
Optional custom title. Default highlights the isochrone budget. |
subtitle |
Optional subtitle. |
line_width |
Width of street lines. Default is 0.4. |
dark |
Logical. If |
A ggplot object.
Simulates the pedestrianization or physical closure of selected street segments and calculates the redistribution of shortest-path betweenness centrality across the remaining network.
walk_scenario_betweenness( network, closed_edges = NULL, snap_tolerance_m = 0, radius_m = NULL, verbose = TRUE )walk_scenario_betweenness( network, closed_edges = NULL, snap_tolerance_m = 0, radius_m = NULL, verbose = TRUE )
network |
A |
closed_edges |
Integer vector of edge row indices to remove. |
snap_tolerance_m |
Snapping tolerance in meters for network repair. Default is 0.0. |
radius_m |
Optional metric search cutoff in meters. |
verbose |
Logical. |
A walk_scenario_betweenness S3 object containing comparison metrics,
augmented edges with delta betweenness, and top diverted streets.
if (requireNamespace("igraph", quietly = TRUE)) { data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) sim <- walk_scenario_betweenness(net, closed_edges = c(5, 10)) print(sim) }if (requireNamespace("igraph", quietly = TRUE)) { data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) sim <- walk_scenario_betweenness(net, closed_edges = c(5, 10)) print(sim) }
Creates an independent copy of a walkable street network with specified street segments (edges) or junctions (nodes) removed (simulating street cuts, construction, or pedestrianization). Reconstructs Compressed Sparse Row topology and component connectivity using compiled Rust.
walk_scenario_close( network, edge_indices = NULL, node_indices = NULL, name = "scenario_closure" )walk_scenario_close( network, edge_indices = NULL, node_indices = NULL, name = "scenario_closure" )
network |
A |
edge_indices |
Integer vector of edge row indices to remove (1-indexed). |
node_indices |
Optional integer vector of node indices whose attached edges will be removed. |
name |
Descriptive character label for this intervention scenario. |
A new walk_network S3 object representing the modified scenario, with
metadata storing the closed edges.
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) cierre <- walk_scenario_close(net, edge_indices = c(5, 12), name = "Peatonalizacion Central") print(cierre)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) cierre <- walk_scenario_close(net, edge_indices = c(5, 12), name = "Peatonalizacion Central") print(cierre)
Finds the optimal walking route between an origin and destination across the
street graph using Dijkstra's algorithm compiled in Rust. Supports node IDs,
numeric coordinate vectors c(x, y), or sf point geometries.
walk_shortest_path(network, from, to)walk_shortest_path(network, from, to)
network |
A |
from |
Origin location: either an integer node index, a numeric vector
|
to |
Destination location: either an integer node index, a numeric vector
|
A walk_path S3 object containing:
path_sf |
|
nodes_sf |
|
node_ids |
Sequence of node IDs visited. |
distance_m |
Total walking route distance in meters. |
time_s |
Total travel time in seconds at the network walking speed. |
time_min |
Total travel time in minutes. |
circuity |
Detour ratio (network path distance / straight-line Euclidean distance). |
from_node |
Resolved origin node index. |
to_node |
Resolved destination node index. |
network |
The input |
data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) orig <- sf::st_coordinates(net$nodes[net$nodes$is_giant, ])[1, 1:2] dest <- sf::st_coordinates(net$nodes[net$nodes$is_giant, ])[50, 1:2] p <- walk_shortest_path(net, from = orig, to = dest) print(p)data(streets_cusco) net <- walk_build_network(streets_cusco, verbose = FALSE) orig <- sf::st_coordinates(net$nodes[net$nodes$is_giant, ])[1, 1:2] dest <- sf::st_coordinates(net$nodes[net$nodes$is_giant, ])[50, 1:2] p <- walk_shortest_path(net, from = orig, to = dest) print(p)