View source: R/aemet_api_query.R
get_data_aemet | R Documentation |
Client tool to get data and metadata from AEMET and convert json to
tibble
.
get_data_aemet(apidest, verbose = FALSE)
get_metadata_aemet(apidest, verbose = FALSE)
apidest |
Character string as destination URL. See https://opendata.aemet.es/dist/index.html. |
verbose |
Logical |
A tibble
(if possible) or the results of the query as
provided by httr2::resp_body_raw()
or httr2::resp_body_string()
.
https://opendata.aemet.es/dist/index.html.
Some examples on how to use these functions on
vignette("extending-climaemet")
.
# Run this example only if AEMET_API_KEY is detected
url <- "/api/valores/climatologicos/inventarioestaciones/todasestaciones"
get_data_aemet(url)
# Metadata
get_metadata_aemet(url)
# We can get data from any API endpoint
# Plain text
plain <- get_data_aemet("/api/prediccion/nacional/hoy")
cat(plain)
# An image
image <- get_data_aemet("/api/mapasygraficos/analisis")
# Write and read
tmp <- tempfile(fileext = ".gif")
writeBin(image, tmp)
gganimate::gif_file(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.