Learn R Programming

rcrisp (version 0.3.1)

as_network: 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)

Value

An sfnetworks::sfnetwork object

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)

Examples

Run this code
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)

Run the code above in your browser using DataLab