Bags (baga) are the subdivisions of soums; there are about 1,650 of them.
Their codes and names are built in (see mn_codes("bag")), but their
boundaries are not openly published: the National Statistics Office of
Mongolia (NSO) shares them on request. Once you have a bag boundary file,
mn_bags() and every other function in the package can use it.
Arguments
- aimag, soum
Keep only bags in these aimags or soums (names or codes).
- path
Path to a bag boundary file readable by
sf::st_read(). Defaults togetOption("mongolmaps.bags_path").- resolution
"low"(default) uses simplified boundaries that ship with the package and suit most maps."high"uses full-resolution boundaries, downloaded once (about 10 MB) and cached; seemn_cache_dir().- lang
Language of the
namecolumn:"en"(English, as in NSO tables),"mn"(Cyrillic) or"mns"(Latin with diacritics, MNS 5217). Defaults togetOption("mongolmaps.lang", "en").- crs
Coordinate reference system of the result.
NULL(default) keeps longitude/latitude (EPSG:4326). Use"albers","lcc"or"utm"for a projection suited to Mongolia (seemn_crs()), or any value accepted bysf::st_crs().- code_col
Name of the column holding bag codes: 7-digit NSO codes (
"1830151") or P-codes ("MN830151").NULLdetects it.- check_nesting
If
TRUE(default), stop when a bag lies outside its soum.
Value
An sf tibble; see mn_admin() for the columns.
Getting bag boundaries
Write to NSO (international@nso.mn) and ask for the bag boundaries as a
shapefile or GeoPackage, with each bag's NSO code. Then either pass the
file to mn_bags(path = ...), or register it once per session with
options(mongolmaps.bags_path = "path/to/bags.gpkg") (put that line in
your .Rprofile to make it permanent). Registered bags are also returned
by mn_admin("bag") and used by mn_join().
mn_read_bags() checks the file: every bag must have a known code and
sit inside its soum.
See also
Other admin boundaries:
mn_admin(),
mn_aimags(),
mn_country(),
mn_soums(),
mn_ub()
Examples
# Codes and names of all bags, without boundaries:
mn_codes("bag", within = "Khovd")
#> # A tibble: 91 × 16
#> pcode name name_en name_mn name_mns level type number iso_code nso_code
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> <chr> <chr>
#> 1 MN840151 1-r b… 1-r ba… 1-р ба… 1-r bag… bag bag 1 NA 1840151
#> 2 MN840153 2-r b… 2-r ba… 2-р ба… 2-r bag… bag bag 2 NA 1840153
#> 3 MN840155 3-r b… 3-r ba… 3-р ба… 3-r bag… bag bag 3 NA 1840155
#> 4 MN840157 4-r b… 4-r ba… 4-р ба… 4-r bag… bag bag 4 NA 1840157
#> 5 MN840159 5-r b… 5-r ba… 5-р ба… 5-r bag… bag bag 5 NA 1840159
#> 6 MN840161 6-r b… 6-r ba… 6-р ба… 6-r bag… bag bag 6 NA 1840161
#> 7 MN840163 7-r b… 7-r ba… 7-р ба… 7-r bag… bag bag 7 NA 1840163
#> 8 MN840165 8-r b… 8-r ba… 8-р ба… 8-r bag… bag bag 8 NA 1840165
#> 9 MN840167 9-r b… 9-r ba… 9-р ба… 9-r bag… bag bag 9 NA 1840167
#> 10 MN840169 10-r … 10-r b… 10-р б… 10-r ba… bag bag 10 NA 1840169
#> # ℹ 81 more rows
#> # ℹ 6 more variables: parent_pcode <chr>, region_pcode <chr>,
#> # aimag_pcode <chr>, soum_pcode <chr>, area_km2 <dbl>, has_geometry <lgl>
# Without a bag boundary file, mn_bags() explains how to get one:
try(mn_bags())
#> Error in mn_bags() :
#> Bag boundaries are not openly published, so they are not included.
#> ℹ Ask NSO for them (international@nso.mn), then use `mn_bags(path =
#> "bags.gpkg")`.
#> ℹ Bag codes and names are available now: `mn_codes("bag")`.
#> ℹ Khoroos of Ulaanbaatar are available now: `mn_khoroos()`.
# With the file from NSO (not run, as the file is not public):
if (FALSE) { # \dontrun{
mn_bags(aimag = "Khovd", path = "bags_from_nso.gpkg")
} # }