Joins geoconnex mainstem identifiers onto a table that contains NHDPlusV2 (comid/featureid) or NHDPlusHR (nhdplusid) identifiers using a lookup table.
add_mainstems(x, join_col = NULL, join_col_type = NULL)data.frame or sf containing an identifier column joinable to NHDPlusV2 or NHDPlusHR.
character name of the identifier column in x.
Detected automatically from comid, featureid, or nhdplusid (any case)
if not provided.
character one of "nhdpv2" or "nhdphr". Detected
automatically from join_col if not provided.
x with mainstem_uri and mainstemid columns added.
Source data comes from the ref_rivers GitHub release here. The csv source data is downloaded once, converted to parquet, and cached in the user data dir indicated by hydrogeofetch_data_dir.
# \donttest{
add_mainstems(data.frame(comid = c(2804607, 2804621)))
#> comid mainstem_uri mainstemid
#> 1 2804607 https://geoconnex.us/ref/mainstems/1826652 1826652
#> 2 2804621 https://geoconnex.us/ref/mainstems/1826652 1826652
# }