header_tag.html

Skip to contents

This function creates the call for discrete water quality samples data service described at https://waterdata.usgs.gov/download-samples. Note: all possible arguments are included, but it is strongly recommended to only use the NECESSARY arguments. Leave unnecessary arguments as the default NA.

Usage

construct_USGS_sample_request(
  monitoringLocationIdentifier = NA,
  siteTypeCode = NA,
  boundingBox = NA,
  hydrologicUnit = NA,
  activityMediaName = NA,
  characteristicGroup = NA,
  characteristic = NA,
  characteristicUserSupplied = NA,
  activityStartDateLower = NA,
  activityStartDateUpper = NA,
  countryFips = NA,
  stateFips = NA,
  countyFips = NA,
  projectIdentifier = NA,
  recordIdentifierUserSupplied = NA,
  siteTypeName = NA,
  usgsPCode = NA,
  pointLocationLatitude = NA,
  pointLocationLongitude = NA,
  pointLocationWithinMiles = NA,
  dataType = "Results",
  dataProfile = NA
)

Arguments

monitoringLocationIdentifier

A monitoring location identifier has two parts: the agency code and the location number. Location identifiers should be separated with commas, for example: AZ014-320821110580701, CAX01-15304600, USGS-040851385. Location numbers without an agency prefix are assumed to have the prefix USGS.

siteTypeCode

Site type code query parameter. See available options by running check_param("sitetype")$typeCode.

boundingBox

North and South are latitude values; East and West are longitude values. A vector of 4 (west, south, east, north) is expected. An example would be: c(-92.8, 44.2, -88.9, 46.0).

hydrologicUnit

Hydrologic Unit Codes (HUCs) identify physical areas within the US that drain to a certain portion of the stream network. This filter accepts values containing 2, 4, 6, 8, 10 or 12 digits.

activityMediaName

Sample media refers to the environmental medium that was sampled or analyzed.

characteristicGroup

Characteristic group is a broad category describing the sample. See available options by running check_param("characteristicgroup")$characteristicGroup.

characteristic

Characteristic is a specific category describing the sample. See available options by running check_param("characteristics")$characteristicName.

characteristicUserSupplied

Observed property is the USGS term for the constituent sampled and the property name gives a detailed description of what was sampled. Observed property is mapped to characteristicUserSupplied and replaces the parameter name and pcode USGS previously used to describe discrete sample data. Find more information in the Observed Properties and Parameter Codes section of the Code Dictionary found here: https://waterdata.usgs.gov/code-dictionary/.

activityStartDateLower

The service will return records with dates earlier than the value entered for activityStartDateUpper. Can be an R Date object, or a string with format YYYY-MM-DD. The logic is inclusive, i.e. it will also return records that match the date.

activityStartDateUpper

The service will return records with dates later than the value entered for activityStartDateLower. Can be an R Date object, or a string with format YYYY-MM-DD. The logic is inclusive, i.e. it will also return records that match the date.

countryFips

Country query parameter. Do not set redundant parameters. If another query parameter contains the country information, leave this parameter set to the default NA. See available options by running check_param("countries"), the value needed is "id" from that result.

stateFips

State query parameter. To get a list of available state fips, run check_param("states"). The "fips" can be created using the function stateCdLookup.

countyFips

County query parameter. To get a list of available counties, run check_param("counties"). The "Fips" can be created using the function countyCdLookup.

projectIdentifier

Project identifier query parameter. This information would be needed from prior project information.

recordIdentifierUserSupplied

Record identifier, user supplied identifier. This information would be needed from the data supplier.

siteTypeName

Site type name query parameter. See available options by running check_param("sitetype")$typeName.

usgsPCode

USGS parameter code. See available options by running check_param("characteristics")$parameterCode.

pointLocationLatitude

Latitude for a point/radius query. Must be used with pointLocationLongitude and pointLocationWithinMiles.

pointLocationLongitude

Longitude for a point/radius query. Must be used with pointLocationLatitude and pointLocationWithinMiles.

pointLocationWithinMiles

Radius for a point/radius query. Must be used with pointLocationLatitude and pointLocationLongitude

dataType

Options include: "Results", "Monitoring locations", "Activities", "Projects", and "Organizations".

dataProfile

Profile depends on type. Options for "Results" dataType are: "Full physical chemical", "Basic physical chemical", "Full biological", "Basic biological", "Narrow". Options for "Monitoring location" are: "Site" and "Count". Options for "Activities" are "Sample Activities", "Activity Metrics", "Activity Groups", "Count". Options for "Projects" are: "Project" and "Project Monitoring Location Weight". Options for "Organizations" are: "Organization" and "Count".

Value

data frame returned from web service call.

Examples


# \donttest{
req <- construct_USGS_sample_request(
               monitoringLocationIdentifier = "USGS-04074950",
               characteristicUserSupplied = "pH, water, unfiltered, field")
#> Function in development, use at your own risk.
#> No profile specified, defaulting to 'Full physical chemical'
#> Possible values are: 
#> Full physical chemical, Basic physical chemical, Full biological, Basic biological, Narrow, Count, Lab Sample Prep, Result Detection Quantitation Limit
rawData <- importWQP(req)
#> GET:https://api.waterdata.usgs.gov/samples-data/results/fullphyschem?mimeType=text%2Fcsv&monitoringLocationIdentifier=USGS-04074950&characteristicUserSupplied=pH%2C%20water%2C%20unfiltered%2C%20field

# }