st_network_faces: Extract the faces of a spatial network

View source: R/faces.R

st_network_facesR Documentation

Extract the faces of a spatial network

Description

The faces of a spatial network are the areas bounded by edges, without any other edge crossing it. A special face is the outer face, which is the area not bounded by any set of edges.

Usage

st_network_faces(x, boundary = NULL)

Arguments

x

An object of class sfnetwork.

boundary

The boundary used for the outer face, as an object of class sf or sfc containing a single POLYGON geometry. Note that this boundary should always be larger than the bounding box of the network. If NULL (the default) the network bounding box extended by 0.1 times its diameter is used.

Value

An object of class sfc with POLYGON geometries, in which each feature represents one face of the network.

Examples

library(sf, quietly = TRUE)

oldpar = par(no.readonly = TRUE)
par(mar = c(1,1,1,1))

pts = st_transform(mozart, 3035)
net = as_sfnetwork(pts, "delaunay")

faces = st_network_faces(net)

plot(faces, col = sf.colors(length(faces), categorical = TRUE))
plot(net, add = TRUE)

par(oldpar)


luukvdmeer/sfnetworks documentation built on Nov. 21, 2024, 4:54 a.m.