| add_measures | R Documentation |
given a set of connected flowlines that have ids and aggregate ids, adds from_aggregate_id_measure and to_aggregate_id_measure for use with index_points_to_lines
Aggregate ids, such as mainstem ids or reachcodes span multiple flowlines. Linear referencing along these features requires knowledge of the portion of the aggregate line a given flowline makes up. This function assumes that the complete aggregate feature is included and calculates the measure of the top and bottom of each flowline along each aggregate line.
add_measures(x)
## S3 method for class 'data.frame'
add_measures(x)
## S3 method for class 'hy'
add_measures(x)
x |
sf data.frame compatible with hydroloom_names with at least id and aggregate_id attributes. A pre-populated toid attribute will be used if present. |
If no "toid" attribute is included, make_attribute_topology is used to to create one. This is required to ensure the flowlines making up each aggregate line are sorted in a known upstream to downstream order.
This function assumes that all flowlines that make up an aggregate feature are included. Returned measures will be incomplete and incorrect if aggregate features (mainstems of reaches) are truncated.
x with aggregate measures added to it
g <- sf::read_sf(system.file("extdata/new_hope.gpkg", package = "hydroloom"))
d <- dplyr::select(g, COMID, REACHCODE) |>
sf::st_cast("LINESTRING")
add_measures(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.