Package 'rgeoboundaries'

Title: geoBoundaries Client
Description: Provides access to the geoBoundaries international boundary database <https://www.geoboundaries.org>, a NSF and foundation supported dataset of subnational boundaries around the globe. Methods allow you to access data directly from the API <https://www.geoboundaries.org/api/current/> to query for the geometric boundaries for any country, globally. For more details, refer to the publication by Runfola et al. (2020) <doi:10.1371/journal.pone.0231866>.
Authors: Ahmadou Dicko [aut], Ahmadou Dicko [cre], Andy South [ctb], Daniel Runfola [ctb], Rohith Reddy Mandala [ctb]
Maintainer: Ahmadou Dicko <[email protected]>
License: MIT + file LICENSE
Version: 1.3
Built: 2024-11-26 07:23:44 UTC
Source: https://github.com/cranhaven/cranhaven.r-universe.dev

Help Index


rgeoboundaries

Description

R client to access geoBoundaries API

Author(s)

[email protected]


Get the highest administrative level available for a given country

Description

Get the highest administrative level available for a given country

Usage

gb_max_adm_lvl(
  country = NULL,
  release_type = c("gbOpen", "gbHumanitarian", "gbAuthoritative")
)

Arguments

country

characher; a vector of country names or iso3 country codes.

release_type

character; This is one of gbOpen, gbHumanitarian, or gbAuthoritative. For most users, we suggest using gbOpen, as it is CC-BY 4.0 compliant, and can be used for most purposes so long as attribution is provided. gbHumanitarian files are mirrored from UN OCHA, but may have less open licensure. gbAuthoritative files are mirrored from UN SALB, and cannot be used for commerical purposes, but are verified through in-country processes. Default to gbOpen.

Value

a data.frame with the country names and corresponding highest administrative level


Get metadata for a country, administrative level, type of data and version

Description

Get metadata for a country and an administrative level, type of data and version

Usage

gb_metadata(
  country = NULL,
  adm_lvl = "all",
  release_type = c("gbOpen", "gbHumanitarian", "gbAuthoritative")
)

Arguments

country

characher; a vector of country names or iso 3 country codes

adm_lvl

characher or integer; administrative level, adm0, adm1, adm2, adm3, adm4 or adm5. adm0 being the country. 0, 1, 2, 3, 4 or 5 can also be used.

release_type

character; This is one of gbOpen, gbHumanitarian, or gbAuthoritative. For most users, we suggest using gbOpen, as it is CC-BY 4.0 compliant, and can be used for most purposes so long as attribution is provided. gbHumanitarian files are mirrored from UN OCHA, but may have less open licensure. gbAuthoritative files are mirrored from UN SALB, and cannot be used for commerical purposes, but are verified through in-country processes. Default to gbOpen.

Value

returns metadata from the api


Get the administrative boundaries of selected countries

Description

Access country boundaries at a specified administrative level

Usage

geoboundaries(
  country = NULL,
  adm_lvl = "adm0",
  type = c("unsimplified", "simplified", "UNSIMPLIFIED", "SIMPLIFIED", "HPSCU", "HPSCGS",
    "SSCGS", "SSCU", "CGAZ", "hpscu", "hpscgs", "sscgs", "sscu", "cgaz"),
  release_type = c("gbOpen", "gbHumanitarian", "gbAuthoritative"),
  quiet = TRUE,
  overwrite = FALSE,
  version = deprecated()
)

gb_adm0(
  country = NULL,
  type = NULL,
  release_type = NULL,
  quiet = TRUE,
  overwrite = FALSE,
  version = deprecated()
)

gb_adm1(
  country = NULL,
  type = NULL,
  release_type = NULL,
  quiet = TRUE,
  overwrite = FALSE,
  version = deprecated()
)

gb_adm2(
  country = NULL,
  type = NULL,
  release_type = NULL,
  quiet = TRUE,
  version = deprecated()
)

gb_adm3(
  country = NULL,
  type = NULL,
  release_type = NULL,
  quiet = TRUE,
  overwrite = FALSE,
  version = deprecated()
)

gb_adm4(
  country = NULL,
  type = NULL,
  release_type = NULL,
  quiet = TRUE,
  overwrite = FALSE,
  version = deprecated()
)

gb_adm5(
  country = NULL,
  type = NULL,
  release_type = NULL,
  quiet = TRUE,
  overwrite = FALSE,
  version = deprecated()
)

Arguments

country

characher; a vector of country names or country ISO3. If NULL all countries will be used for adm0, adm1, adm2 where the administrative level are available

adm_lvl

character; administrative level, adm0, adm1, adm2, adm3, adm4 or adm5. adm0 being the country boundary. 0, 1, 2, 3, 4 or 5 can also be used.

type

character; One of simplified and unsimplified. Determines the type of boundary to use. Default to unsimplified.

release_type

character; This is one of gbOpen, gbHumanitarian, or gbAuthoritative. For most users, we suggest using gbOpen, as it is CC-BY 4.0 compliant, and can be used for most purposes so long as attribution is provided. gbHumanitarian files are mirrored from UN OCHA, but may have less open licensure. gbAuthoritative files are mirrored from UN SALB, and cannot be used for commerical purposes, but are verified through in-country processes. Default to gbOpen

quiet

logical; if TRUE no message while downloading and reading the data. Default to FALSE

overwrite

logical; if TRUE overwrite the files downloaded previously in the cache. Default to FALSE.

version

character; deprecated parameter.

Details

Different types of boundaries are available:

  • unsimplified - The premier geoBoundaries release, representing the highest precision files available for every country in the world. No standardization is performed on these files, so (for example) two countries may overlap in the case of contested boundaries.

  • simplified - A simplified version of every file available for every country in the world. No standardization is performed on these files, so (for example) two countries may overlap in the case of contested boundaries.

The following wrappers are also available:

  • gb_adm0 returns the country boundaries

  • gb_adm1 if available, returns the country first administrative level boundaries

  • gb_adm2 if available, returns the country second administrative level boundaries

  • gb_adm3 if avaiable, returns the country third administrative level boundaries

  • gb_adm4 if available, returns the country fourth administrative level boundaries

  • gb_adm5 if available, returns the country first administrative level boundaries

Value

a sf object

References

Runfola D, Anderson A, Baier H, Crittenden M, Dowker E, Fuhrig S, et al. (2020) geoBoundaries: A global database of political administrative boundaries. PLoS ONE 15(4): e0231866. https://doi.org/10.1371/journal.pone.0231866

Examples

# Get administrative boundaries for Canada at adm1 level
canada_adm1 <- geoboundaries(country = "Canada", adm_lvl = "adm1")

# Get administrative boundaries for all countries at adm0 level
all_countries_adm0 <- geoboundaries()