ms_identify_usgs_gauges: Identify USGS gauges near a point

View source: R/ms_identify_usgs_gauges.R

ms_identify_usgs_gaugesR Documentation

Identify USGS gauges near a point

Description

Search for USGS gauges within a radius of a location specified by latitude and longitude

Usage

ms_identify_usgs_gauges(sites, lat = NULL, long = NULL, radius = 500)

Arguments

sites

Either an sf object with locations of interest or a data.frame containing latitude and longitude information.

lat

Character. If sites is not a sf object, the name of the column containing latitudes in WGS84. Default NULL.

long

Character. If sites is not a sf object, the name of the column containing longitudes in WGS84. Default NULL.

radius

Numeric. The radius in meters within which to search for USGS gauges; Default 500.

Details

This function will search for a USGS gauge within the radius supplied for every site in the sites file. The dataRetrieval package is used to locate USGS gauges. If no USGS gauge is found, then the usgs_site column will be NA for that site.

Value

returns a data.frame with the column usgs_site.

Author(s)

Spencer Rhea

Mike Vlah, vlahm13@gmail.com

Wes Slaughter

Examples

# With lat long 
sites <- tibble(site_code = c('MA_AE03', 'MI_KR01'),
                Latitude = c(42.04856, 42.28575),
                Longitude = c(-72.45403, -85.51467))
ms_identify_usgs_gauges(sites = sites, lat = 'Latitude', long = 'Longitude')

# With sf
site_sf <- sites %>%
    sf::st_as_sf(coords = c('long', 'lat'), crs = 4326) %>%
    sf::st_buffer(radius)

MacroSHEDS/macrosheds documentation built on Oct. 30, 2024, 11:15 a.m.