Title: | A Client to geoBoundaries, A Political Administrative Boundaries Dataset |
---|---|
Description: | Client the access data from the geoBoundaries API who provides country political administrative boundaries dataset. |
Authors: | Ahmadou Dicko [aut, cre], Andy South [ctb], Daniel Runfola [ctb], Rohith Reddy Mandala [ctb] |
Maintainer: | Ahmadou Dicko <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.9000 |
Built: | 2024-11-12 05:27:07 UTC |
Source: | https://github.com/wmgeolab/rgeoboundaries |
Manage cached geoBoundaries downloaded files
gb_set_cache(path) gb_get_cache(create = FALSE) gb_clear_cache(force = FALSE) gb_list_cache(full_path = FALSE) gb_delete_from_cache(file)
gb_set_cache(path) gb_get_cache(create = FALSE) gb_clear_cache(force = FALSE) gb_list_cache(full_path = FALSE) gb_delete_from_cache(file)
path |
character; path of the directory to set |
create |
logical; if TRUE create missing cache |
force |
logical; force delete. default: |
full_path |
logical; if TRUE returns the full path of the file |
file |
Character, the file to delete |
The default cache directory is
~/.cache/R/gb_cache
, but you can set
your own path using gb_set_cache(path)
the cache directory
list of files in the cache
This function will clear all cached files
## Not run: gb_cache ## change the default cache directory tmp <- tempdir() gb_set_cache(tmp) ## print current cache directory gb_get_cache() ## List available files in the current cache directory gb_list_cache() l <- gb_list_cache()[1] ## get the first file gb_delete_from_cache(l) ## delete it gb_clear_cache() ## delete all cached files ## End(Not run)
## Not run: gb_cache ## change the default cache directory tmp <- tempdir() gb_set_cache(tmp) ## print current cache directory gb_get_cache() ## List available files in the current cache directory gb_list_cache() l <- gb_list_cache()[1] ## get the first file gb_delete_from_cache(l) ## delete it gb_clear_cache() ## delete all cached files ## End(Not run)
Get the highest administrative level available for a given country
gb_max_adm_lvl( country = NULL, release_type = c("gbOpen", "gbHumanitarian", "gbAuthoritative") )
gb_max_adm_lvl( country = NULL, release_type = c("gbOpen", "gbHumanitarian", "gbAuthoritative") )
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. |
a data.frame with the country names and corresponding highest administrative level
Get metadata for a country and an administrative level, type of data and version
gb_metadata( country = NULL, adm_lvl = "all", release_type = c("gbOpen", "gbHumanitarian", "gbAuthoritative") )
gb_metadata( country = NULL, adm_lvl = "all", release_type = c("gbOpen", "gbHumanitarian", "gbAuthoritative") )
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. |
Access country boundaries at a specified administrative level
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() )
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() )
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. |
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
a sf
object
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