Build a road network graph from sf LINESTRING data
build_network(
roads_sf,
crs_out = 3857,
node_intersections = FALSE,
snap_tol = 0,
simplify = TRUE
)A list with components:
roads: cleaned sf object
nodes: sf POINT object with node_id
edges: sf LINESTRING object with from, to, length
graph: igraph object
A: sparse adjacency matrix
An sf object with LINESTRING geometry
Integer EPSG code for projected CRS
Logical; if TRUE, "node" the linework by splitting at interior intersections/junctions (via `sf::st_union()`), so that crossings and T-junctions become graph nodes even when they are not endpoints. This may increase the number of edge segments.
Nonnegative numeric; optional snapping tolerance (in projected CRS units) used to merge nearly identical endpoints. Use 0 to disable.
Logical; if TRUE, remove self-loops and parallel edges.