The arcs are shared boundaries or standalone boundaries from polygons.

sf_arcnode(x)

Arguments

x

sf polygons

Value

sf object of LINESTRING

Details

The feature identity is stored in a list of data frames (the row id of the input feature).

Create lines from shared boundaries between polygons. A single copy of a shared boundary is created as 'sf' lines, keeping the row identity of the input polygon/s. It's expected that polygons have clean neighbour boundaries and don't overlap.

Examples

f <- system.file("gpkg/nc.gpkg", package = "sf", mustWork = TRUE) sfx <- sf::read_sf(f) arcs <- sf_arcnode(sfx) plot(arcs["arc"], col = sample(hcl.colors(nrow(arcs))))
s <- sample(seq_len(dim(sfx)[1L]), 1L) plot(sfx[arcs$feature_ids[[s]]$row, 1], reset = FALSE, col = c("grey", "grey10"))
#> Warning: col is not of length 1 or nrow(x): colors will be recycled; use pal to specify a color palette
plot(arcs[s, 1], add = TRUE, col = "hotpink2", lwd = 6)
plot(sfx$geom, col = sample(grey.colors(10), 100, replace = TRUE), reset = FALSE)
plot(dplyr::sample_n(arcs[1L], 20), col = "hotpink2", lwd = 6, add = TRUE)