Skip to contents

Attribution is required for all uses of this dataset.

This function returns a global composite of the required administrative level, clipped to international boundaries, with gaps filled between borders.

Usage

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

Source

geoBoundaries API Service https://www.geoboundaries.org/api.html.

Arguments

country

A character vector of country codes. It can be either "all" (which returns the data for all countries), a vector of country names, or ISO3 country codes. See also countrycode::countrycode().

adm_lvl

Type of boundary. Accepted values are administrative levels 0, 1, and 2 ("adm0" is the country boundary, "adm1" is the first level of sub-national boundaries, "adm2" is the second level, and so on). Upper-case versions ("ADM1") and the number of the level (0, 1, 2) are also accepted.

quiet

Logical. If TRUE, suppress informational messages.

overwrite

Logical. If TRUE, force a fresh download of the source .zip file.

cache_dir

A path to a cache directory. If not set (the default NULL), the data will be stored in the default cache directory (see gb_set_cache_dir()). If no cache directory has been set, files will be stored in the temporary directory (see base::tempdir()). See caching strategies in gb_set_cache_dir().

Value

A sf object.

Details

Comprehensive Global Administrative Zones (CGAZ) are a set of global composites for administrative boundaries. There are two important distinctions between our global product and individual country downloads.

  • Extensive simplification is performed to ensure that file sizes are small enough to be used in most traditional desktop software.

  • Disputed areas are removed and replaced with polygons following US Department of State definitions.

References

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

See also

Other API 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: www.geoboundaries.org")

# }