Finds the nearest long term NOAA gauge to each input site using
sf::st_nearest_feature(), joins the corresponding gauge attributes to
the site table, and calculates the straight-line distance between the site
and gauge.
Value
An data.frame object containing the original site attributes and geometry, attributes of the nearest gauge, and distance to the gauge in meters and kilometers.
Details
sites may be data frame containing latitude and
longitude columns or existing sf objects.
Distances are straight-line geographic distances. For coastal and estuarine applications, the nearest gauge by straight-line distance may not necessarily be the most hydrologically connected gauge. This also won't work outside the U.S.