Retrieves the beaches available from the AEMET API.
Caching
The first result retrieved in each session is temporarily cached in
tempdir() to avoid unnecessary requests.
Examples
library(dplyr)
beaches <- aemet_beaches()
beaches
#> # A tibble: 591 × 10
#> ID_PLAYA NOMBRE_PLAYA ID_PROVINCIA NOMBRE_PROVINCIA ID_MUNICIPIO
#> <chr> <chr> <chr> <chr> <chr>
#> 1 0301101 Raco de l'Albir 03 Alacant/Alicante 03011
#> 2 0301401 Sant Joan / San Juan 03 Alacant/Alicante 03014
#> 3 0301408 El Postiguet 03 Alacant/Alicante 03014
#> 4 0301410 Saladar 03 Alacant/Alicante 03014
#> 5 0301808 La Roda 03 Alacant/Alicante 03018
#> 6 0301809 Cap Blanch 03 Alacant/Alicante 03018
#> 7 0303102 Llevant / Playa de Levan… 03 Alacant/Alicante 03031
#> 8 0303104 Ponent / Playa de Ponien… 03 Alacant/Alicante 03031
#> 9 0304105 Cala Fustera 03 Alacant/Alicante 03041
#> 10 0304704 La Fossa 03 Alacant/Alicante 03047
#> # ℹ 581 more rows
#> # ℹ 5 more variables: NOMBRE_MUNICIPIO <chr>, LATITUD <chr>, LONGITUD <chr>,
#> # longitud <dbl>, latitud <dbl>
# Cached during this R session.
beaches2 <- aemet_beaches(verbose = TRUE)
#> ℹ Loading "beaches" from a temporary cached file saved at 2026-06-24 14:11:39 UTC.
identical(beaches, beaches2)
#> [1] FALSE
# Select and map beaches.
library(ggplot2)
library(mapSpain)
# Alicante / Alacant.
beaches_sf <- aemet_beaches(return_sf = TRUE) |>
filter(ID_PROVINCIA == "03")
prov <- mapSpain::esp_get_prov("Alicante")
ggplot(prov) +
geom_sf() +
geom_sf(
data = beaches_sf, shape = 4, size = 2.5,
color = "blue"
)
