The user may also be interested in getting the flowlines (i.e., the stream or river network), for their sites of interest. PITcleanr
provide the function queryFlowlines()
to accomplish that. queryFlowlines()
downloads an NHDPlus v2 stream layer from USGS using the suggested nhdplusTools
R package. It requires the spatial location of sites as an sf
object (such as the output of extractSites()
), and a site code identified as the "root" site. The root site might correspond with your tagging or release location and is provided to the root_site_code
argument. The function starts from the root_site_code
and downloads all flowlines upstream from there, with a minimum stream order set by min_strm_order
.
If there are sites downstream of the root_site_code
site in the users site list, downstream flowlines will also be downloaded. By default, the upstream and downstream flowlines will be combined into a single sf
object. However, if the user would like to keep them separated, they can set the argument combine_up_down
to FALSE
, and the downstream flowlines will be returned as a separate element.
The queryFlowlines()
function returns a list consisting of:
flowlines
: the flowlines upstream of the root_site_code
(and possibly the downstream ones as well)basin
: the polygon containing the upstream flowlinesThe default option (combine_up_down = TRUE
) like to combine the flowlines upstream and downstream of the root site. If the user sets combine_up_down = FALSE
, the function will return a third element in the list called:
dwn_flowlines
: the flowlines downstream of the root_site_code
.Depending on the spatial extent of your flowlines, the queryFlowlines()
function may take awhile. More information on the nhdplusTools
R package can be found here.
# query the flowlines nhd_list = queryFlowlines(sites_sf = sites_sf, root_site_code = "TUM", min_strm_order = 2) # join the upstream and downstream flowlines flowlines = nhd_list$flowlines
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.