
Get USGS Field Measurement Metadata
Source:R/read_waterdata_field_meta.R
read_waterdata_field_meta.RdThis endpoint provides metadata about field measurement collections, including when the earliest and most recent observations for a parameter occurred at a monitoring location and its units.
Usage
read_waterdata_field_meta(
monitoring_location_id = NA_character_,
parameter_code = NA_character_,
parameter_name = NA_character_,
parameter_description = NA_character_,
begin = NA_character_,
end = NA_character_,
last_modified = NA_character_,
properties = NA_character_,
skipGeometry = NA,
bbox = NA,
limit = NA,
convertType = TRUE,
no_paging = FALSE
)Arguments
- monitoring_location_id
A unique identifier representing a single monitoring location. This corresponds to the
idfield in themonitoring-locationsendpoint. Monitoring location IDs are created by combining the agency code of the agency responsible for the monitoring location (e.g. USGS) with the ID number of the monitoring location (e.g. 02238500), separated by a hyphen (e.g. USGS-02238500).Multiple monitoring_location_ids can be requested as a character vector.
- parameter_code
Parameter codes are 5-digit codes used to identify the constituent measured and the units of measure. A complete list of parameter codes and associated groupings can be found at https://api.waterdata.usgs.gov/ogcapi/v0/collections/parameter-codes/items.
Multiple parameter_codes can be requested as a character vector.
- parameter_name
A human-understandable name corresponding to
parameter_code. Multiple parameter_names can be requested as a character vector.- parameter_description
A description of what the parameter code represents, as used by WDFN and other USGS data dissemination products.
Multiple parameter_descriptions can be requested as a character vector.
- begin
This field contains the same information as "begin_utc", but in the local time of the monitoring location. It is retained for backwards compatibility, but will be removed in V1 of these APIs.
See also Details below for more information.
- end
This field contains the same information as "end_utc", but in the local time of the monitoring location. It is retained for backwards compatibility, but will be removed in V1 of these APIs.
See also Details below for more information.
- last_modified
The last time a record was refreshed in our database. This may happen due to regular operational processes and does not necessarily indicate anything about the measurement has changed. You can query this field using date-times or intervals, adhering to RFC 3339, or using ISO 8601 duration objects. Intervals may be bounded or half-bounded (double-dots at start or end). Examples:
A date-time: "2018-02-12T23:20:50Z"
A bounded interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z"
Half-bounded intervals: "2018-02-12T00:00:00Z/.." or "../2018-03-18T12:31:12Z"
Duration objects: "P1M" for data from the past month or "PT36H" for the last 36 hours
Only features that have a
last_modifiedthat intersects the value of datetime are selected.See also Details below for more information.
- properties
A vector of requested columns to be returned from the query. Available options are: geometry, field_measurement_id, monitoring_location_id, parameter_code, parameter_name, parameter_description, begin, end, last_modified. The default (
NA) will return all columns of the data.- 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.
- 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). Coordinates are assumed to be in crs 4326. The expected format is a numeric vector structured: c(xmin,ymin,xmax,ymax). Another way to think of it is c(Western-most longitude, Southern-most latitude, Eastern-most longitude, Northern-most longitude).
- limit
The optional limit parameter is used to control the subset of the selected features that should be returned in each page. The maximum allowable limit is 50000. It may be beneficial to set this number lower if your internet connection is spotty. The default (
NA) will set the limit to the maximum allowable limit for the service.- convertType
logical, defaults to
TRUE. IfTRUE, the function will convert the data to dates and qualifier to string vector.- no_paging
logical, defaults to
FALSE. IfTRUE, the data will be requested from a native csv format. This can be dangerous because the data will cut off at 50,000 rows without indication that more data is available. UseTRUEwith caution.
Details
You can also use a vector of length 2 for any time queries (such as time
or last_modified). The first value is the starting date (or datetime),
the second value is the ending date(or datetime).
NA's within the vector indicate a half-bound date.
For example, time = c("2024-01-01", NA) will return all data starting
at 2024-01-01.
time = c(NA, "2024-01-01") will return all data from the beginning of
the timeseries until 2024-01-01.
By default, time is assumed UTC, although time zone attributes
will be accommodated. As an example, setting time = as.POSIXct(c("2021-01-01 12:00:00",
"2021-01-01 14:00"), tz = "America/New_York") will request data that between
noon and 2pm eastern time on 2021-01-01.
All time values RETURNED from the service are UTC with the exception of
daily data, which returns time values in local dates.
Examples
# \donttest{
site <- "USGS-02238500"
field_data_sf <- read_waterdata_field_meta(monitoring_location_id = site)
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/field-measurements-metadata/items?f=json&lang=en-US&monitoring_location_id=USGS-02238500&limit=50000
#> Remaining requests this hour:2925
groundwater <- read_waterdata_field_meta(monitoring_location_id = "USGS-375907091432201")
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/field-measurements-metadata/items?f=json&lang=en-US&monitoring_location_id=USGS-375907091432201&limit=50000
#> Remaining requests this hour:2926
gwl_data <- read_waterdata_field_meta(monitoring_location_id = "USGS-02238500",
parameter_code = "00060",
begin = as.POSIXct(c(NA,
"2025-08-27 12:00:00"),
tz = "America/Chicago"),
skipGeometry = TRUE)
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/field-measurements-metadata/items?f=json&lang=en-US&skipGeometry=TRUE&monitoring_location_id=USGS-02238500¶meter_code=00060&limit=50000
#> Remaining requests this hour:2925
gwl_data_period <- read_waterdata_field_meta(
monitoring_location_id = "USGS-375907091432201",
parameter_code = "72019",
last_modified = "P1Y")
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/field-measurements-metadata/items?f=json&lang=en-US&monitoring_location_id=USGS-375907091432201¶meter_code=72019&last_modified=P1Y&limit=50000
#> Remaining requests this hour:2924
multi_site <- read_waterdata_field_meta(
monitoring_location_id = c("USGS-451605097071701",
"USGS-263819081585801"),
parameter_code = c("62611", "72019"))
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/field-measurements-metadata/items?f=json&lang=en-US&monitoring_location_id=USGS-451605097071701,USGS-263819081585801¶meter_code=62611,72019&limit=50000
surface_water <- read_waterdata_field_meta(
monitoring_location_id = c("USGS-07069000",
"USGS-07064000",
"USGS-07068000"),
end = "2024-07-01T00:00:00Z/..",
parameter_code = "00060")
#> Requesting:
#> https://api.waterdata.usgs.gov/ogcapi/v0/collections/field-measurements-metadata/items?f=json&lang=en-US&monitoring_location_id=USGS-07069000,USGS-07064000,USGS-07068000¶meter_code=00060&end=2024-07-01T00%3A00%3A00Z%2F..&limit=50000
# }