Package 'rwswadar'

Title: Access Water Quality and Quantity Information from the RWS WADAR Database
Description: A wrapper for the 'Swagger Application Programming Interface' that serves data from the WADAR database of Rijkswaterstaat (RWS). More information at <https://www.rijkswaterstaat.nl/water/waterdata>.
Authors: Pepijn de Vries [aut, cre] (ORCID: <https://orcid.org/0000-0002-7961-6646>), Marinka van Puijenbroek [aut] (ORCID: <https://orcid.org/0000-0003-1237-6403>)
Maintainer: Pepijn de Vries <[email protected]>
License: GPL (>= 3)
Version: 0.0.0.9002
Built: 2026-12-04 09:18:41 UTC
Source: https://github.com/pepijn-devries/rwswadar

Help Index


Check Availability of Data in the RWS WADAR Database

Description

Query specific fields in the database and find out if there are records available, given the specified restraints.

Usage

rws_check(AquoMetadataLijst, LocatieLijst, Periode, ...)

Arguments

AquoMetadataLijst

A named vector of codes to filter results. Allowed names and accompanying values can be listed with rws_get_catalogue(Grootheden = TRUE)$AquoJoined.

LocatieLijst

A vector of location codes. A list of valid codes can be obtained with rws_get_catalogue(join = FALSE)$LocatieLijst

Periode

A vector of two values: a start datetime and end datetime. The vector can consist of any type that can be converted into a datetime object by lubridate.

...

Ignored.

Value

A named list indicating if records are available from the data base given the specified restrictions.

Examples

if (interactive()) {
  rws_check(
    AquoMetadataLijst = c(
      Grootheid    = "WATHTE",
      Hoedanigheid = "NAP",
      Compartiment = "OW"
    ),
    LocatieLijst   = "denhelder.marsdiep",
    Periode        = c("1988-01-27", "2023-01-27")
  )
}

Get WADAR API Catalogue Information

Description

Need to know which fields you can query, when requesting data? Consult the catologue with this function to find out.

Usage

rws_get_catalogue(
  BemonsteringsApparaten = FALSE,
  BemonsteringsMethoden = FALSE,
  BemonsteringsSoorten = FALSE,
  BioTaxon = FALSE,
  BioTaxonType = FALSE,
  Compartimenten = FALSE,
  Eenheden = FALSE,
  Grootheden = FALSE,
  Hoedanigheden = FALSE,
  MeetApparaten = FALSE,
  Organen = FALSE,
  Parameters = FALSE,
  Typeringen = FALSE,
  Groeperingen = FALSE,
  WaardeBepalingsmethoden = FALSE,
  WaardeBepalingstechnieken = FALSE,
  WaardeBewerkingsmethoden = FALSE,
  ProcesTypes = FALSE,
  simplify = TRUE,
  join = simplify,
  ...
)

Arguments

BemonsteringsApparaten, BemonsteringsMethoden, BemonsteringsSoorten, BioTaxon, BioTaxonType, Compartimenten, Eenheden, Grootheden, Hoedanigheden, MeetApparaten, Organen, Parameters, Typeringen, Groeperingen, WaardeBepalingsmethoden, WaardeBepalingstechnieken, WaardeBewerkingsmethoden, ProcesTypes

Fields for which to obtain valid Codes for querying. If TRUE it will be included in the response. If not, it will be ignored.

simplify

A logical value. If set to FALSE the results will be returned as a nested named list. When set to TRUE, the information will be structured into data.frames where possible.

join

A logical value. If TRUE it will join 'Location' and 'Metadata' into a single table. This argument is ignored if simplify=FALSE.

...

Ignored.

Value

Returns a list. If simplify=TRUE it will contain data.frames.

Examples

if (interactive()) {
  rws_get_catalogue(Grootheden = TRUE, Eenheden = TRUE)
}

Get a Named List With API Documentation

Description

Not required for accessing the services. It contains technical specifications and data structures of the RWS WADAR data Swagger API.

Usage

rws_get_docs(...)

Arguments

...

Ignored

Examples

if (interactive()) {
  rws_get_docs()
}

Download Observations for a Specific Location

Description

Download observations for a specific query including a location and period.

Usage

rws_get_observation(AquoMetadataLijst, Locatie, Periode, raw = FALSE, ...)

Arguments

AquoMetadataLijst

A named vector of codes to filter results. Allowed names and accompanying values can be listed with rws_get_catalogue(Grootheden = TRUE)$AquoJoined.

Locatie

A location code. A overview of valid codes can be obtained with rws_get_catalogue()$LocatieLijst

Periode

A vector of two values: a start datetime and end datetime. The vector can consist of any type that can be converted into a datetime object by lubridate.

raw

A logical value. If TRUE it will return a nested named list, just as returned by the API. If FALSE (default) the requested data is coerced to a data.frame, making it easier to use.

...

Arguments passed on to rws_check

LocatieLijst

A vector of location codes. A list of valid codes can be obtained with rws_get_catalogue(join = FALSE)$LocatieLijst

Value

Returns a named list in case of raw=TRUE, or a data.frame otherwise.

Examples

if (interactive()) {
  rws_get_observation(
    AquoMetadataLijst = c(
      Grootheid    = "WATHTE",
      Hoedanigheid = "NAP",
      Compartiment = "OW",
      ProcesType = "meting"
    ),
    Locatie        = "denhelder.marsdiep",
    Periode        = c("2022-12-27", "2023-01-27")
  )
}

Visualise RWS WADAR Data Locations

Description

Use the leaflet package to visualise locations. When hovering over locations with the mouse pointer, the location code will be displayed.

Usage

rws_show_locations(...)

Arguments

...

Ignored.

Examples

if (interactive() && requireNamespace("leaflet")) {
  rws_show_locations()
}