Skip to contents

Full-resolution boundaries and the larger thematic layers are downloaded the first time you use them and kept in a cache folder, so later calls work offline.

Usage

mn_cache_dir()

mn_cache_list()

mn_cache_clear(layers = NULL, old_versions = FALSE)

mn_download(layers = "all")

mn_assets()

mn_cache_verify(layers = NULL)

Arguments

layers

Layer ids or groups (see mn_sources()), such as "admin_high" or "osm". NULL (the default for mn_cache_clear()) means all; "all" (the default for mn_download()) means every fixed-file downloadable layer. WorldPop is opt-in: use "worldpop" for every year/resolution, or an id such as "worldpop_2025_1km".

old_versions

If TRUE, mn_cache_clear() removes only data left by older versions of the package.

Value

mn_cache_dir(): a path. mn_cache_list(): a tibble with one row per cached file. mn_cache_clear() and mn_download(): the affected paths, invisibly.

Details

  • mn_cache_dir() returns the cache folder. Change it with options(mongolmaps.cache_dir = "path").

  • mn_cache_list() lists what is cached.

  • mn_cache_clear() deletes cached files. Old revisions are retained unless explicitly removed with old_versions = TRUE.

  • mn_cache_verify() hashes downloaded assets to check their integrity.

  • mn_assets() lists concrete assets, including WorldPop years/resolutions.

  • mn_download() downloads layers now, for example before fieldwork without internet. See mn_sources() for the layer ids.

See also

Other data sources and cache: mn_provenance(), mn_sources()

Examples

mn_cache_dir()
#> [1] "/home/runner/.cache/R/mongolmaps"
mn_cache_list()
#> # A tibble: 0 × 7
#> # ℹ 7 variables: data_version <chr>, file <chr>, size_mb <dbl>, path <chr>,
#> #   modified <dttm>, layer <chr>, has_checksum <lgl>
mn_download("admin_high")
#> ℹ Downloading Full-resolution administrative boundaries (3.7 MB); this happens
#>   once.