gb_get_world: Download global composite boundaries from *geoBoundaries*

View source: R/gb-get-world.R

gb_get_worldR Documentation

Download global composite boundaries from geoBoundaries

Description

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

CGAZ boundaries are not covered by the package's MIT license. Attribution is required when sharing the boundaries or derived products.

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 country codes. Use "all" to return boundaries for all countries. See also countrycode::countrycode() from countrycode.

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 not set (the default NULL), boundary archives are stored in the default cache directory (see gb_set_cache_dir()). If no cache directory has been set, archives are stored in a temporary cache directory. See base::tempdir() and the cache strategies in gb_set_cache_dir().

Details

Comprehensive Global Administrative Zones (CGAZ) are global composites for administrative boundaries. Compared with individual country boundaries, global composite boundaries use extensive simplification so file sizes are small enough for most desktop software. They remove disputed areas, replace them with polygons following United States Department of State definitions and fill gaps between borders.

Follow the citation and use information included in the downloaded CGAZ archive. CGAZ and figures derived from it are not relicensed under the package's MIT license.

Value

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

Source

References

Runfola et al. (2020) "geoBoundaries: A global database of political administrative boundaries." PLOS ONE, 15(4), 1–9. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1371/journal.pone.0231866")}.

See Also

gb_get_metadata() inspects boundary metadata and licensing. gb_get_max_adm_lvl() checks the ADM levels available for individual country boundaries. gb_set_cache_dir() configures where downloaded archives are cached.

Boundary download functions: gb_get(), gb_get_adm

Examples


# This download may take some time.
## Not run: 
world <- gb_get_world()

library(ggplot2)

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

## End(Not run)


geobounds documentation built on Sept. 6, 2026, 1:06 a.m.