Skip to contents

This dataset contains world administrative boundaries at the country level. It includes regions, labels, boundaries, coastal lines and inland boundaries. Available scales depend on the geometry type and release year.

This function reads the aggregated GISCO country dataset. Use gisco_get_unit_country() to download individual country files.

Usage

gisco_get_countries(
  year = 2024,
  epsg = 4326,
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE,
  resolution = 20,
  spatialtype = "RG",
  country = NULL,
  region = NULL,
  ext = "gpkg"
)

Source

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

Arguments

year

A character string or numeric value with the release year of the file. One of "2024", "2020", "2016", "2013", "2010", "2006", "2001" .

epsg

A character string or numeric value with the coordinate reference system as a 4-digit EPSG code. One of:

cache

A logical value indicating whether to cache results. Defaults to TRUE. 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.

cache_dir

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

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.

spatialtype

A character string with the type of geometry to return. Available values are:

  • "RG": Regions - MULTIPOLYGON/POLYGON object.

  • "LB": Labels - POINT object.

  • "BN": Boundaries - LINESTRING object.

  • "COASTL": Coastal lines - LINESTRING object.

  • "INLAND": Inland boundaries - LINESTRING object.

    Arguments country and region are only applied when spatialtype is "RG" or "LB".

country

A character vector of country names, ISO 3166-1 alpha-3 codes or Eurostat country codes. See countrycode::countrycode().

region

An optional character vector of UN M49 region names ("Africa", "Americas", "Asia", "Europe" or "Oceania") or "EU" for EU member countries as of 2021. See World regions and gisco_countrycode.

ext

A character string with the extension of the file (default "gpkg"). One of "shp", "gpkg", "geojson" .

Value

An sf object or NULL if the download fails.

World regions

Regions follow the UN geographic regions (see https://unstats.un.org/unsd/methodology/m49/). Under this scheme, Cyprus is assigned to Asia.

See the GISCO administrative unit copyright provisions: https://ec.europa.eu/eurostat/web/gisco/geodata/administrative-units.

Note

Check the download and usage provisions in gisco_attributions().

See also

gisco_countrycode, gisco_countries_2024, gisco_get_metadata(), countrycode::countrycode().

See gisco_bulk_download() to perform a bulk download of datasets.

See gisco_get_unit_country() to download single-unit files.

See gisco_id_api_country() to download via the GISCO ID service API.

Administrative unit datasets: gisco_get_communes(), gisco_get_postal_codes()

Examples

cntries <- gisco_get_countries()

library(ggplot2)
ggplot(cntries) +
  geom_sf()


# Get a region.

africa <- gisco_get_countries(region = "Africa")
ggplot(africa) +
  geom_sf(fill = "#078930", col = "white") +
  theme_minimal()