Skip to contents

[Deprecated]

mn_boundaries() was deprecated in mongolstats 0.3.0. Use the mongolmaps package instead: mongolmaps::mn_admin() and its shortcuts (mn_country(), mn_aimags(), mn_soums(), ...) ship boundaries that carry NSO codes, need no download, and join to NSO tables by code with mongolmaps::mn_join().

mn_boundaries() downloads boundaries for ADM0/ADM1/ADM2 from the geoBoundaries API and returns an sf object (the sf package must be installed). Results are cached in memory for the session.

Usage

mn_boundaries(level = c("ADM0", "ADM1", "ADM2"), refresh = FALSE)

Arguments

level

One of "ADM0", "ADM1", "ADM2".

refresh

If TRUE, bypass the session cache and download again.

Value

An sf object with polygons for the requested level. Failed downloads raise an error of class mongolstats_http_error.

Examples

if (FALSE) { # identical(Sys.getenv("NOT_CRAN"), "true") && curl::has_internet() && rlang::is_installed("sf")
aimags <- mn_boundaries("ADM1")
# ->
if (rlang::is_installed("mongolmaps")) {
  aimags <- mongolmaps::mn_aimags()
}
}