diff --git a/NAMESPACE b/NAMESPACE index 09c1aa36b06a4658da1320686e7d3660c9000168..8342d3c0907d387b33a93bf72ea0f7a28b2beee9 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,6 +7,7 @@ export(get_hydrometrie_sites) export(get_hydrometrie_stations) export(get_indicateurs_services_communes) export(get_indicateurs_services_indicateurs) +export(get_niveaux_nappes_stations) export(get_prelevements_chroniques) export(get_prelevements_ouvrages) export(get_prelevements_points_prelevement) diff --git a/R/get_hydrometrie_stations.R b/R/get_hydrometrie_stations.R index 8e7899e4c057b3c8b7802c0211f321a4217d958b..fd4286adba169d4ee1bc25a73344c10e85b4c3fd 100644 --- a/R/get_hydrometrie_stations.R +++ b/R/get_hydrometrie_stations.R @@ -5,7 +5,7 @@ #' @template param_get_common #' @param code_sandre_reseau_station optional [logical] indicating if `code_sandre_reseau_station` field is included in the result; if so, one line is added by item and other fields are repeated #' -#' @return a [tibble::tibble] with all available parameters in columns and one row by device, year and usage. +#' @return a [tibble::tibble] with all available parameters in columns and one row by station. #' @export #' #' @examples diff --git a/R/get_niveaux_nappes_stations.R b/R/get_niveaux_nappes_stations.R new file mode 100644 index 0000000000000000000000000000000000000000..e8884ee752a060323a40df98ba755500c0c34bb3 --- /dev/null +++ b/R/get_niveaux_nappes_stations.R @@ -0,0 +1,25 @@ +#' Retrieve piezometric stations from API "Piézométrie" +#' +#' See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-piezometrie} +#' +#' @template param_get_common +#' +#' @return a [tibble::tibble] with all available parameters in columns and one row by station. +#' @export +#' +#' @examples +#' # For retrieving the hydrometric stations in the department of Aube +#' get_niveaux_nappes_stations(list(code_departement = "10")) +#' +get_niveaux_nappes_stations <- function(params, cfg = config::get(file = system.file("config.yml", + package = "hubeau"))) { + l <- doApiQuery(api = "niveaux_nappes", + operation = "stations", + params = params, + cfg = cfg) + l <- lapply(l, function(x) { + x$geometry <- NULL + x + }) + convert_list_to_tibble(l) +} diff --git a/R/hubeau.R b/R/hubeau.R index afb1eec73e6a2005e6d13662c40e86ab96d77ea6..5ec0d15ad03867e6057c89dfcda7dfa794050b75 100644 --- a/R/hubeau.R +++ b/R/hubeau.R @@ -23,6 +23,14 @@ #' - [get_indicateurs_services_communes] #' - [get_indicateurs_services_indicateurs] #' +#' **API "Piézométrie"** +#' +#' API documentation: \url{https://hubeau.eaufrance.fr/page/api-piezometrie} +#' +#' Available functions: +#' +#' - [get_niveaux_nappes_stations] +#' #' **API "Prélèvements en eau"** #' #' API documentation: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau} diff --git a/inst/config.yml b/inst/config.yml index 55ff964c15bc7f17c179c807628f1b8818429da8..9d15239d4500268cf329f47161ab4af7460bf680 100644 --- a/inst/config.yml +++ b/inst/config.yml @@ -150,3 +150,50 @@ default: - latitude - longitude - timestep + niveaux_nappes: + path: v1/niveaux_nappes + operations: + stations: + path: stations + fields: + - bbox + - bss_id + - code_bdlisa + - code_bss + - code_commune + - code_departement + - codes_masse_eau_edl + - date_recherche + - fields + - srid + sites: + path: referentiel/sites + fields: + - bbox + - code_commune_site + - code_cours_eau + - code_departement + - code_region + - code_site + - code_troncon_hydro_site + - code_zone_hydro_site + - distance + - fields + - latitude + - libelle_cours_eau + - libelle_site + - longitude + observations_tr: + path: observations_tr + fields: + - bbox + - code_entite + - cursor + - date_debut_obs + - date_fin_obs + - distance + - fields + - grandeur_hydro + - latitude + - longitude + - timestep diff --git a/man/get_hydrometrie_stations.Rd b/man/get_hydrometrie_stations.Rd index 8f8b1c1a33a9db7ca5bc4884a1aac57bda701510..029f6b8ef77c8b8f52fbf13ec84d5b18d1f33ab8 100644 --- a/man/get_hydrometrie_stations.Rd +++ b/man/get_hydrometrie_stations.Rd @@ -19,7 +19,7 @@ get_hydrometrie_stations( configuration} } \value{ -a \link[tibble:tibble]{tibble::tibble} with all available parameters in columns and one row by device, year and usage. +a \link[tibble:tibble]{tibble::tibble} with all available parameters in columns and one row by station. } \description{ See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-hydrometrie} diff --git a/man/get_niveaux_nappes_stations.Rd b/man/get_niveaux_nappes_stations.Rd new file mode 100644 index 0000000000000000000000000000000000000000..279e1a1e1004fdfcdc36a0dcbdd2112358ba2b85 --- /dev/null +++ b/man/get_niveaux_nappes_stations.Rd @@ -0,0 +1,28 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/get_niveaux_nappes_stations.R +\name{get_niveaux_nappes_stations} +\alias{get_niveaux_nappes_stations} +\title{Retrieve piezometric stations from API "Piézométrie"} +\usage{ +get_niveaux_nappes_stations( + params, + cfg = config::get(file = system.file("config.yml", package = "hubeau")) +) +} +\arguments{ +\item{params}{a \link{list} the list of parameters of the queries and their values in the format \code{list(ParamName = "Param value", ...)}, use the function \link{get_available_params} for a list of the available parameters for a given operation in an API and see the API documentation for the complete list of available filter parameters} + +\item{cfg}{a \link{config} object Configuration of the communication. Use by default the internal package +configuration} +} +\value{ +a \link[tibble:tibble]{tibble::tibble} with all available parameters in columns and one row by station. +} +\description{ +See the API documentation for available filter parameters: \url{https://hubeau.eaufrance.fr/page/api-piezometrie} +} +\examples{ +# For retrieving the hydrometric stations in the department of Aube +get_niveaux_nappes_stations(list(code_departement = "10")) + +} diff --git a/man/hubeau.Rd b/man/hubeau.Rd index 312ba33204d82104da32043aa9899f3d5357f4a7..7287b207a66a672ae9fb1f6abc69b7a9e7a65cd7 100644 --- a/man/hubeau.Rd +++ b/man/hubeau.Rd @@ -31,6 +31,15 @@ Available functions: \item \link{get_indicateurs_services_indicateurs} } +\strong{API "Piézométrie"} + +API documentation: \url{https://hubeau.eaufrance.fr/page/api-piezometrie} + +Available functions: +\itemize{ +\item \link{get_niveaux_nappes_stations} +} + \strong{API "Prélèvements en eau"} API documentation: \url{https://hubeau.eaufrance.fr/page/api-prelevements-eau}