Skip to contents

Returns global composite boundaries for the requested ADM level. Boundaries are clipped to international borders, with gaps between borders filled.

Always acknowledge geoBoundaries and follow the terms in the CGAZ archive.

Usage

gb_get_world(
  country = "all",
  adm_lvl = "adm0",
  quiet = TRUE,
  overwrite = FALSE,
  cache_dir = NULL
)

Arguments

country

A character vector of country names or ISO 3166-1 alpha-3 codes. Use "all" to return all countries. The complete global layer is downloaded and read before filtering, so country selection does not reduce the initial download size or the memory needed to read it.

adm_lvl

ADM level. Accepted values are levels 0, 1 and 2 ("adm0" is the country boundary, "adm1" is the first level of subnational boundaries and "adm2" is the second level). Uppercase versions ("ADM1") and level numbers (0, 1, 2) are also accepted, including numbers supplied as text (for example, "1").

quiet

A logical value. If TRUE, suppress informational messages.

overwrite

A logical value. If TRUE, force a fresh download of the source .zip archive.

cache_dir

A path to a cache directory. If NULL, use the configured directory, or a temporary directory when none is configured. See gb_set_cache_dir().

Value

An sf object from sf containing the requested boundaries. Returns NULL if no boundaries match the request or the downloads return no geometries.

Details

CGAZ uses extensive simplification and standardizes disputed areas. See vignette("geobounds", package = "geobounds") for product differences. Archives come from the repository's main branch and historical versions cannot be selected. See vignette("metadata", package = "geobounds") for provenance.

References

Runfola et al. (2020) "geoBoundaries: A global database of political administrative boundaries." PLOS ONE, 15(4), e0231866. doi:10.1371/journal.pone.0231866 .

See also

gb_get() downloads individual country boundaries instead of CGAZ layers. gb_set_cache_dir() configures where downloaded archives are cached. See vignette("geobounds", package = "geobounds") for a comparison of individual country boundaries and global composites.

Boundary download functions: gb_get(), gb_get_adm

Examples

# This download may take some time.
# \dontrun{
world <- gb_get_world()

library(ggplot2)

ggplot(world) +
  geom_sf() +
  coord_sf(expand = FALSE) +
  labs(caption = "Source: geoBoundaries (CGAZ)")

# }