Skip to contents

This dataset contains world administrative boundaries at the country level. It provides 2 feature classes (regions and boundaries) for each scale level, with 5 scale levels available (1M, 3M, 10M, 20M and 60M).

This function gets data from the aggregated GISCO country file. To download individual country files, use gisco_get_unit_country().

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"
)

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 map projection as a 4-digit EPSG code. One of:

cache

A logical value indicating whether to cache results. Default is TRUE. See Caching strategies section in gisco_set_cache_dir().

update_cache

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

cache_dir

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

verbose

A logical value. If TRUE displays 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. Options available are:

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

  • "LB": Labels - POINT object.

  • "BN": Boundaries - LINESTRING object.

  • "COASTL": coastlines - 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 codes. It can be either a vector of country names, a vector of ISO3 country codes or a vector of Eurostat country codes. See also countrycode::countrycode().

region

An optional character vector of UN M49 region codes or European Union membership. Possible values are "Africa", "Americas", "Asia", "Europe", "Oceania" or "EU" for countries belonging to the European Union (as per 2021). See World Regions and gisco_countrycode.

ext

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

Value

A sf object.

World Regions

Regions are defined as per the geographic regions defined by the UN (see https://unstats.un.org/unsd/methodology/m49/. Under this scheme Cyprus is assigned to Asia.

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 files.

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

Other administrative units 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()