construct_api_requests: Create API url

View source: R/construct_api_requests.R

construct_api_requestsR Documentation

Create API url

Description

Main documentation: https://api.waterdata.usgs.gov/ogcapi/v0/, Swagger docs: https://api.waterdata.usgs.gov/ogcapi/v0/openapi?f=html.

Usage

construct_api_requests(
  service,
  properties = NA_character_,
  bbox = NA,
  skipGeometry = FALSE,
  no_paging = FALSE,
  ...
)

Arguments

service

Which service available on https://api.waterdata.usgs.gov/ogcapi/v0/.

properties

The properties that should be included for each feature. The parameter value is a comma-separated list of property names which depend on the service being called.

bbox

Only features that have a geometry that intersects the bounding box are selected.The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (height or depth).

skipGeometry

This option can be used to skip response geometries for each feature. The returning object will be a data frame with no spatial information.

...

Extra parameters from the specific services.

Examples

site <- "USGS-02238500"
pcode <- "00060"
req_dv <- construct_api_requests("daily",
                                 monitoring_location_id = site,
                                 parameter_code = "00060")

req_dv <- construct_api_requests("daily",
                                 monitoring_location_id = site,
                                 parameter_code = c("00060", "00065"))

sites <- c("USGS-01491000", "USGS-01645000")
start_date <- "2018-01-01"
end_date <- "2022-01-01"
req_dv <- construct_api_requests("daily",
                                monitoring_location_id = sites,
                                parameter_code = c("00060", "00065"),
                                datetime = c(start_date, end_date))


dataRetrieval documentation built on March 31, 2026, 5:07 p.m.