| Title: | R Interface to Fieldmaps Data |
|---|---|
| Description: | Access global edge-matched subnational boundaries from R. |
| Authors: | Paul Campbell [aut, cre] (ORCID: <https://orcid.org/0000-0003-1018-6606>) |
| Maintainer: | Paul Campbell <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.0.0.9000 |
| Built: | 2026-05-10 08:11:30 UTC |
| Source: | https://github.com/epicentre-msf/fieldmaps |
Downloads administrative boundary data for a specific administrative level from the fieldmaps dataset. Fieldmaps provides standardized administrative boundaries for humanitarian and development use cases.
get_adm_level( country, level, con = NULL, dataset = "humanitarian", geom = "polygons", check_max_level = TRUE )get_adm_level( country, level, con = NULL, dataset = "humanitarian", geom = "polygons", check_max_level = TRUE )
country |
Character. Country name or ISO3 code to download boundaries for. |
level |
Numeric. Administrative level to retrieve (1, 2, 3, or 4). Level 1 represents the largest sub-national divisions (states/provinces), with higher numbers representing smaller administrative units. |
con |
DuckDB connection object. If NULL, a temporary connection will be created. |
dataset |
Character. Dataset to use, either "humanitarian" or "open". Default is "humanitarian". See https://fieldmaps.io/data/ for details. |
geom |
Character. Geometry type to retrieve: "polygons", "lines", or "points". Default is "polygons". |
check_max_level |
Logical. Whether to validate that the requested level exists for the country. Default is TRUE. |
An sf object containing the administrative boundaries with CRS 4326 (WGS84).
## Not run: # Get level 1 administrative boundaries for Kenya kenya_adm1 <- get_adm_level("Kenya", level = 1) # Get level 2 boundaries using ISO3 code ken_adm2 <- get_adm_level("KEN", level = 2) # Use open dataset instead of humanitarian boundaries <- get_adm_level("Uganda", level = 1, dataset = "open") ## End(Not run)## Not run: # Get level 1 administrative boundaries for Kenya kenya_adm1 <- get_adm_level("Kenya", level = 1) # Get level 2 boundaries using ISO3 code ken_adm2 <- get_adm_level("KEN", level = 2) # Use open dataset instead of humanitarian boundaries <- get_adm_level("Uganda", level = 1, dataset = "open") ## End(Not run)
Downloads all available administrative boundary levels for a country from the fieldmaps dataset. This function automatically determines the maximum administrative level available and retrieves all levels from 1 to the maximum.
get_all_adm_levels( country, dataset = "humanitarian", geom = "polygons", con = NULL )get_all_adm_levels( country, dataset = "humanitarian", geom = "polygons", con = NULL )
country |
Character. Country name or ISO3 code to download boundaries for. |
dataset |
Character. Dataset to use, either "humanitarian" or "open". Default is "humanitarian". See https://fieldmaps.io/data/ for details. |
geom |
Character. Geometry type to retrieve: "polygons", "lines", or "points". Default is "polygons". |
con |
DuckDB connection object. If NULL, a temporary connection will be created. |
A named list of sf objects, with names like "ADM1", "ADM2", etc. Each sf object contains administrative boundaries for that level with CRS 4326 (WGS84).
## Not run: # Get all administrative levels for Somalia somalia_all <- get_all_adm_levels("Somalia") # Access individual levels somalia_adm1 <- somalia_all$ADM1 somalia_adm2 <- somalia_all$ADM2 # Get all levels from open dataset boundaries <- get_all_adm_levels("ETH", dataset = "open") ## End(Not run)## Not run: # Get all administrative levels for Somalia somalia_all <- get_all_adm_levels("Somalia") # Access individual levels somalia_adm1 <- somalia_all$ADM1 somalia_adm2 <- somalia_all$ADM2 # Get all levels from open dataset boundaries <- get_all_adm_levels("ETH", dataset = "open") ## End(Not run)