knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 7, fig.height = 5, # Sharp figures on the website; small ones in the CRAN package. dpi = if (identical(Sys.getenv("IN_PKGDOWN"), "true")) 200 else 96, eval = rlang::is_installed("ggplot2") )
library(mongolmaps)
Ulaanbaatar has three map levels: the city, its 9 districts (duureg) and its 204 khoroos. The layers fit together exactly.
mn_ub() mn_ub_districts() mn_khoroos()
mn_map(mn_ub_districts(), fill = name, label = TRUE)
Baganuur and Bagakhangai are exclaves, far to the east and south-east of the main city. To focus on the city centre, keep the districts you need:
central <- c("Bayangol", "Bayanzurkh", "Chingeltei", "Khan-Uul", "Songinokhairkhan", "Sukhbaatar") mn_map(mn_khoroos(district = central), fill = parent_pcode)
District names accept common abbreviations such as "BZD", "SBD" or
"KhUD", and Cyrillic:
mn_khoroos(district = "\u0411\u0417\u0414")
Khoroos are numbered within their district; the number is in the number
column, and mn_map(label = TRUE) shows it.
mn_map(mn_khoroos(district = "Sukhbaatar"), fill = area_km2, label = TRUE)
To find one khoroo, use mn_match() with the district:
mn_match("15-r khoroo", level = "bag", within = "Bayangol") mn_match("Bayangol 15")
NSO publishes many statistics by khoroo. The example data has the mid-year population:
pop <- mn_example_population[mn_example_population$Year == 2025, ] khoroo_pop <- mn_join(pop, by = "Region", level = "bag", within = "Ulaanbaatar") mn_map( khoroo_pop[khoroo_pop$parent_pcode %in% c("MN1107", "MN1119", "MN1125"), ], fill = value / area_km2, title = "People per km2: Bayangol, Sukhbaatar and Chingeltei" )
mn_leaflet(khoroo_pop, fill = value)
The khoroo boundaries come from the open khoroo-map project, which does not
state where its data come from, so treat them as unofficial. They were
fitted to the official Ulaanbaatar outline; the district boundaries in
mn_ub_districts() are the unions of their khoroos and follow the current
city layout. See ?mn_khoroos for details.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.