Compute all nodes of an sf
LINESTRING object
desplim_all_nodes.Rd
Function for computing all nodes of an sf
MULTILINESTRING or LINESTRING object.
Details
Function to compute all nodes of an sf
LINESTRING object, after
optionally casting input_lines
to substrings. If input_lines
contains
geometries of type MULTILINESTRING, they are cast to LINESTRING before
computing.
Examples
# Generate lines
line1 <- sf::st_linestring(rbind(c(0, 0), c(1, 1)))
line2 <- sf::st_linestring(rbind(c(1, 1), c(2, 0)))
combined_sf <- sf::st_as_sf(sf::st_sfc(line1, line2, crs = 4326))
# Compute all nodes
all_nodes <- desplim_all_nodes(combined_sf)
print(all_nodes)
#> Simple feature collection with 3 features and 0 fields
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 0 ymin: 0 xmax: 2 ymax: 1
#> Geodetic CRS: WGS 84
#> geometry
#> 1 POINT (0 0)
#> 2 POINT (1 1)
#> 3 POINT (2 0)
# Visualise
plot(sf::st_geometry(combined_sf), col = "slateblue3", lwd = 2)
plot(sf::st_geometry(all_nodes), col = "tomato3", pch = 16, cex = 2, add = TRUE)