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

An sf::sf or sf::sfc_LINESTRING object 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

An sfnetworks::sfnetwork 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)),
  crs = sf::st_crs("EPSG:32635")
)

# Run with default values
as_network(edges)

# Only build the spatial network
as_network(edges, flatten = FALSE, clean = FALSE)

rcrisp documentation built on Nov. 24, 2025, 5:07 p.m.