View source: R/gisco-bulk-download.R
| gisco_bulk_download | R Documentation |
Download zipped data from GISCO to the cache_dir
and extract the relevant ones.
gisco_bulk_download(
id = c("countries", "coastal_lines", "communes", "lau", "nuts", "urban_audit",
"postal_codes"),
year = 2016,
cache_dir = NULL,
update_cache = FALSE,
verbose = FALSE,
resolution = 10,
ext = c("shp", "geojson", "svg", "json", "gdb"),
recursive = deprecated(),
...
)
Some arguments only apply to a specific value of "id". For example
"resolution" would be ignored for values "communes", "lau",
"urban_audit" and "postal_codes".
See years available in the corresponding functions:
gisco_get_countries().
gisco_get_coastal_lines().
gisco_get_communes().
gisco_get_lau().
gisco_get_nuts().
gisco_get_urban_audit().
gisco_get_postal_codes().
The usual extensions used across giscoR are "gpkg" and "shp",
however other formats are already available on GISCO. Note that after
performing a bulk download you may need to adjust the default "ext" value
in the corresponding function to connect it with the downloaded files (see
Examples).
A (invisible) character vector with the full path of the files extracted. See Examples.
https://gisco-services.ec.europa.eu/distribution/v2/.
Additional utils for downloading datasets:
gisco_get_unit
tmp <- file.path(tempdir(), "testexample")
dest_files <- gisco_bulk_download(
id = "countries", resolution = 60,
year = 2024, ext = "geojson",
cache_dir = tmp
)
# Read one
library(sf)
read_sf(dest_files[1]) |> head()
# Now we can connect the function with the downloaded data like:
connect <- gisco_get_countries(
resolution = 60,
year = 2024, ext = "geojson",
cache_dir = tmp, verbose = TRUE
)
# Message shows that file is already cached ;)
# Clean
unlink(tmp, force = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.