Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

get_waterbody_index

Get Waterbody Index


Description

given an sf point geometry column, return waterbody id, and COMID of dominant artificial path

Usage

get_waterbody_index(waterbodies, points, flines = NULL, search_radius = 0.1)

Arguments

waterbodies

sf data.frame of type POLYGON or MULTIPOLYGON including COMID attributes.

points

sfc of type POINT

flines

sf data.frame of type LINESTRING or MULTILINESTRING including COMID, WBAREACOMI, and Hydroseq attributes

search_radius

numeric how far to search for a waterbody boundary in units of provided projection

Value

data.frame with two columns, COMID, in_wb_COMID, near_wb_COMID, near_wb_dist, and outlet_fline_COMID. Distance is in units of provided projection.

Examples

source(system.file("extdata/sample_data.R", package = "nhdplusTools"))


waterbodies <- sf::read_sf(sample_data, "NHDWaterbody")

get_waterbody_index(waterbodies,
                    sf::st_sfc(sf::st_point(c(-89.356086, 43.079943)),
                               crs = 4326, dim = "XY"))

nhdplusTools

NHDPlus Tools

v0.4.0
CC0
Authors
David Blodgett [aut, cre], Mike Johnson [ctb] (<https://orcid.org/0000-0002-5288-8350>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.