View source: R/split_flowline.R
split_flowlines | R Documentation |
A wrapper for split_lines that works on nhdplus attributes
split_flowlines(flines, max_length = NULL, events = NULL, para = 0, avoid = NA)
flines |
data.frame with COMID, toCOMID, LENGTHKM and LINESTRING sf column in "meters" projection |
max_length |
maximum segment length to return |
events |
data.frame containing events as generated by nhdplusTools::get_flowline_index() if an 'identifier' attribute is included, it will be passed through in the output table. |
para |
numeric how many threads to use in parallel computation |
avoid |
vector of ids to avoid |
All the flowlines with some split apart. COMIDs are returned as strings with a semantic part number appended. That is .1, .2, ... .10, .11, etc. are appended and must be treated as one would treat a semantic version. .1 is the most upstream and the sequence increases in the downstream direction.
The refactor_nhdplus
function implements a complete
workflow using 'split_flowlines()'.
source(system.file("extdata", "new_hope_data.R", package = "hyRefactor"))
new_hope_flowline <-
dplyr::right_join(dplyr::select(new_hope_flowline, COMID, REACHCODE, FromMeas, ToMeas),
suppressWarnings(nhdplusTools::prepare_nhdplus(
new_hope_flowline, 0, 0, 0, FALSE, warn = FALSE)),
by = "COMID")
split <- split_flowlines(suppressWarnings(sf::st_cast(sf::st_transform(
new_hope_flowline, 5070), "LINESTRING")),
max_length = 2000, events = new_hope_events)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.