Get AEMET stations.
Details
The first result of the API call in each session is temporarily cached in
tempdir() to avoid unnecessary API calls.
Note
Code modified from project https://github.com/SevillaR/aemet.
API key
You need to set your API key globally using aemet_api_key().
Examples
library(tibble)
stations <- aemet_stations()
stations
#> # A tibble: 920 × 7
#> indicativo indsinop nombre provincia altitud longitud latitud
#> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl>
#> 1 B013X "08304" ESCORCA, LLUC ILLES BA… 490 2.89 39.8
#> 2 B051A "08316" SÓLLER, PUERTO BALEARES 5 2.69 39.8
#> 3 B087X "" BANYALBUFAR ILLES BA… 60 2.51 39.7
#> 4 B103B "" ANDRATX - SANT ELM BALEARES 52 2.37 39.6
#> 5 B158X "" CALVIÀ, ES CAPDELLÀ BALEARES 50 2.47 39.6
#> 6 B228 "08301" PALMA, PUERTO ILLES BA… 3 2.63 39.6
#> 7 B236C "" PALMA, UNIVERSITAT ILLES BA… 95 2.64 39.6
#> 8 B248 "08303" SIERRA DE ALFABIA, BU… ILLES BA… 1030 2.71 39.7
#> 9 B275E "08302" SON BONET, AEROPUERTO BALEARES 47 2.71 39.6
#> 10 B278 "08306" PALMA DE MALLORCA, AE… BALEARES 5 2.74 39.6
#> # ℹ 910 more rows
# Cached during this R session
stations2 <- aemet_stations(verbose = TRUE)
#> ℹ Loading stations from temporary cached file saved at 2026-05-18 22:21:30 UTC
identical(stations, stations2)
#> [1] TRUE
