Returns a list of sites from the Water Quality Portal web service. This function gets
the data from: https://www.waterqualitydata.us.
Arguments to the function should be based on
https://www.waterqualitydata.us/webservices_documentation.
The information returned from whatWQPdata describes the
available data at the WQP sites, and some metadata on the sites themselves.
For example, a row is returned for each individual site that fulfills this
query. In that we can learn how many sampling activities and results
are available for the query. It does not break those results down by any finer
grain. For example, if you ask for "Nutrients" (characteristicGroup), you will
not learn what specific nutrients are available at that site. For that
kind of data discovery see readWQPsummary
.
Usage
whatWQPdata(..., saveFile = tempfile(), convertType = TRUE)
Arguments
- ...
see https://www.waterqualitydata.us/webservices_documentation for a complete list of options. A list of arguments can also be supplied. One way to figure out how to construct a WQP query is to go to the "Advanced" form in the Water Quality Portal: https://www.waterqualitydata.us/#mimeType=csv&providers=NWIS&providers=STORET Use the form to discover what parameters are available. Once the query is set in the form, scroll down to the "Query URL". You will see the parameters after "https://www.waterqualitydata.us/#". For example, if you chose "Nutrient" in the Characteristic Group dropdown, you will see characteristicType=Nutrient in the Query URL. The corresponding argument for dataRetrieval is characteristicType = "Nutrient". dataRetrieval users do not need to include mimeType, and providers is optional (these arguments are picked automatically).
- saveFile
path to save the incoming geojson output.
- convertType
logical, defaults to
TRUE
. IfTRUE
, the function will convert the data to dates, datetimes, numerics based on a standard algorithm. If false, everything is returned as a character.
Examples
# \donttest{
site1 <- whatWQPdata(siteid = "USGS-01594440")
#> NEWS: Data does not include USGS data newer than March 11, 2024. More details:
#> https://doi-usgs.github.io/dataRetrieval/articles/Status.html
#> GET: https://www.waterqualitydata.us/data/Station/search?siteid=USGS-01594440&mimeType=geojson
type <- "Stream"
sites <- whatWQPdata(countycode = "US:55:025", siteType = type)
#> NEWS: Data does not include USGS data newer than March 11, 2024. More details:
#> https://doi-usgs.github.io/dataRetrieval/articles/Status.html
#> GET: https://www.waterqualitydata.us/data/Station/search?countycode=US%3A55%3A025&siteType=Stream&mimeType=geojson
lakeSites <- whatWQPdata(siteType = "Lake, Reservoir, Impoundment",
countycode = "US:55:025")
#> NEWS: Data does not include USGS data newer than March 11, 2024. More details:
#> https://doi-usgs.github.io/dataRetrieval/articles/Status.html
#> GET: https://www.waterqualitydata.us/data/Station/search?siteType=Lake%2C%20Reservoir%2C%20Impoundment&countycode=US%3A55%3A025&mimeType=geojson
lakeSites_chars <- whatWQPdata(
siteType = "Lake, Reservoir, Impoundment",
countycode = "US:55:025", convertType = FALSE)
#> NEWS: Data does not include USGS data newer than March 11, 2024. More details:
#> https://doi-usgs.github.io/dataRetrieval/articles/Status.html
#> GET: https://www.waterqualitydata.us/data/Station/search?siteType=Lake%2C%20Reservoir%2C%20Impoundment&countycode=US%3A55%3A025&mimeType=geojson
# }
bbox <- c(-86.9736, 34.4883, -86.6135, 34.6562)
what_bb <- whatWQPdata(bBox = bbox)
#> NEWS: Data does not include USGS data newer than March 11, 2024. More details:
#> https://doi-usgs.github.io/dataRetrieval/articles/Status.html
#> GET: https://www.waterqualitydata.us/data/Station/search?bBox=-86.9736%2C34.4883%2C-86.6135%2C34.6562&mimeType=geojson