as_network: Create a network from a collection of line strings.

View source: R/network.R

as_networkR Documentation

Create a network from a collection of line strings.

Description

Create a network from a collection of line strings.

Usage

as_network(edges, flatten = TRUE, clean = TRUE)

Arguments

edges

A data frame with the network edges

flatten

Whether all intersections between edges should be converted to nodes

clean

Whether general cleaning tasks should be run on the generated network (see clean_network() for the description of tasks)

Value

A spatial network object

Examples

edges <- sf::st_sfc(
  sf::st_linestring(matrix(c(0, 0, 1, 1), ncol = 2, byrow = TRUE)),
  sf::st_linestring(matrix(c(0, 1, 1, 0), ncol = 2, byrow = TRUE))
)
sf::st_crs(edges) <- sf::st_crs("EPSG:4326")
as_network(edges)

rcrisp documentation built on Aug. 8, 2025, 6:42 p.m.