get_node: Get Line Node

View source: R/utils.R

get_nodeR Documentation

Get Line Node

Description

Given one or more lines, returns a particular node from the line.

Usage

get_node(x, position = "end")

Arguments

x

sf sf data.frame with one or more LINESTRING features

position

character either "start" or "end"

Value

sf data.frame containing requested nodes

Examples


x <- sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom"))

start <- get_node(x, "start")
end <- get_node(x, "end")

plot(sf::st_zm(sf::st_geometry(x)),
     lwd = x$StreamOrde, col = "blue")
plot(sf::st_geometry(start), add = TRUE)

plot(sf::st_zm(sf::st_geometry(x)),
     lwd = x$StreamOrde, col = "blue")
plot(sf::st_geometry(end), add = TRUE)


hydroloom documentation built on Sept. 11, 2024, 8:20 p.m.