gisco_bulk_download: GISCO geodata bulk download

View source: R/gisco-bulk-download.R

gisco_bulk_downloadR Documentation

GISCO geodata bulk download

Description

Download zipped data from GISCO to the cache_dir and extract the relevant files.

Usage

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(),
  ...
)

Arguments

id

A character string or numeric value with the dataset type to download, see Details. Supported values are:

  • "countries".

  • "coastal_lines".

  • "communes".

  • "lau".

  • "nuts".

  • "urban_audit".

  • "postal_codes".

    This argument replaces the previous (deprecated) argument id_giscoR.

year

A character string or numeric value with the release year of the file, see Details.

cache_dir

A character string with a path to a cache directory. See the Caching strategies section in gisco_set_cache_dir().

update_cache

A logical value indicating whether to refresh the cached file. Defaults to FALSE. When set to TRUE, it forces a new download.

verbose

A logical value indicating whether to display informational messages.

resolution

A character string or numeric value with the geospatial data resolution. One of:

  • "60": 1:60 million.

  • "20": 1:20 million.

  • "10": 1:10 million.

  • "03": 1:3 million.

  • "01": 1:1 million.

ext

The extension of the file or files to download. Available formats are "shp", "geojson", "svg", "json" and "gdb". See Details.

recursive

[Deprecated] recursive is no longer supported. It will never perform recursive extraction of child .zip files. This is the case for shp.zip inside the top-level .zip, which will not be unzipped.

...

Ignored. The argument id_giscoR ([Deprecated]) is captured via ... and redirected to id with a warning.

Details

Some arguments only apply to a specific value of id. For example, resolution is ignored for values "communes", "lau", "urban_audit" and "postal_codes".

See available years 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", but other formats are already available on GISCO. After 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).

Value

An invisible character vector with the full paths of the extracted files. See Examples.

Source

https://gisco-services.ec.europa.eu/distribution/v2/.

See Also

gisco_get_metadata() to inspect available datasets, years and file formats before downloading.

Bulk and single-unit downloads: gisco_get_unit

Examples


tmp <- file.path(tempdir(), "testexample")

dest_files <- gisco_bulk_download(
  id = "countries", resolution = 60,
  year = 2024, ext = "geojson",
  cache_dir = tmp
)
# Read one file.
library(sf)
read_sf(dest_files[1]) |> head()

# Connect the function with the downloaded data.

invisible(gisco_get_countries(
  resolution = 60,
  year = 2024, ext = "geojson",
  cache_dir = tmp, verbose = TRUE
))

# The message shows that the file is already cached.

# Clean up.
unlink(tmp, force = TRUE)


giscoR documentation built on Oct. 1, 2026, 5:13 p.m.