Get AEMET beaches.
Details
The first result of the API call on each session is (temporarily) cached in
the assigned tempdir()
for avoiding unneeded API calls.
API Key
You need to set your API Key globally using aemet_api_key()
.
See also
Other aemet_api_data:
aemet_alert_zones()
,
aemet_alerts()
,
aemet_daily_clim()
,
aemet_extremes_clim()
,
aemet_forecast_beaches()
,
aemet_forecast_daily()
,
aemet_forecast_fires()
,
aemet_last_obs()
,
aemet_monthly
,
aemet_normal
,
aemet_stations()
Examples
library(tibble)
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 temporal cached file saved at 2024-11-27 12:51:33 UTC
identical(beaches, beaches2)
#> [1] FALSE
# Select an map beaches
library(dplyr)
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"
)