Learn R Programming

giscoR (version 0.1.1)

gisco_get_countries: Download Geospatial Country Data from GISCO

Description

Downloads a simple feature (sf) object.

Usage

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

Arguments

resolution

Resolution of the geospatial data. One of

  • "60" (1:60million),

  • "20" (1:20million)

  • "10" (1:10million)

  • "03" (1:3million) or

  • "01" (1:1million).

year

Release year. One of "2001", "2006", "2010", "2013", "2016" or "2020"

epsg

projection of the map: 4-digit EPSG code. One of:

  • "4326" - WGS84

  • "3035" - ETRS89 / ETRS-LAEA

  • "3857" - Pseudo-Mercator

cache

a logical whether to do caching. Default is TRUE.

update_cache

a logical whether to update cache.

cache_dir

a path to a cache directory. The directory have to exist. The NULL (default) uses and creates /gisco directory in the temporary directory from tempdir. The directory can also be set with options(gisco_cache_dir = <path>).

spatialtype

Type of geometry to be returned:

  • RG: Regions - Multipolygon

  • LB: Labels - Point

  • BN: Boundaries - Multilines

  • COASTL: coastlines - Multilines

  • INLAND: inland boundaries - Multilines

country

Optional. A character vector of countries. See Details

region

Optional. A character vector of UN M49 region codes. Possible values are "Africa", "Americas", "Asia", "Europe", "Oceania". See Details and gisco_countrycode

Value

a sf object.

Details

country and region only available when applicable.

country could be either a vector of country names, a vector of ISO3 country codes or a vector of Eurostat country codes.

See Also

gisco_countrycode

Examples

Run this code
# NOT RUN {
library(sf)

sf_world <- gisco_get_countries()
plot(st_geometry(sf_world), col = "seagreen2")
title(sub = gisco_attributions(), line = 1)


sf_africa <- gisco_get_countries(region = 'Africa')
plot(st_geometry(sf_africa),
     col = c("springgreen4", "darkgoldenrod1", "red2"))
title(sub = gisco_attributions(), line = 1)


sf_benelux <-
  gisco_get_countries(country = c('Belgium', 'Netherlands', 'Luxembourg'))
plot(st_geometry(sf_benelux),
     col = c("grey10", "orange", "deepskyblue2"))
title(sub = gisco_attributions(), line = 1)
# }

Run the code above in your browser using DataLab