data-raw/nivo_stations.R

#' Reads geojson stations file, restricts to french Alps and writes .rda file
#'
#' @return
use_nivo_stations <- function() {
  nivo_stations <- geojsonsf::geojson_sf(
    "https://donneespubliques.meteofrance.fr/donnees_libres/Txt/Nivo/postesNivo.json")
  nivo_stations <- nivo_stations[, c("ID", "Nom", "Altitude", "geometry")] %>%
    dplyr::rename(station = ID,
                  nom = Nom,
                  altitude = Altitude) %>%
    dplyr::mutate(station = readr::parse_integer(station),
                  altitude = readr::parse_integer(altitude)) %>%
    restrict_to_french_alps()

  usethis::use_data(nivo_stations, overwrite = TRUE)
}
vadmbertr/bonski.data documentation built on Dec. 23, 2021, 2:06 p.m.