gadm_spatial: gadm spatial

gadm_spatialR Documentation

gadm spatial

Description

Download and read GADM boundaries without depending on geodata.

Usage

gadm_spatial(country = "ESP", 
    level = 2, path = tools::R_user_dir("basifoR", 
        "cache"), ext = c("json", 
        "gpkg"), version = "4.1", 
    quiet = TRUE)

Arguments

country

ISO3 country code. The default downloads Spain.

level

Administrative level to download. For Spain, level 2 is commonly useful as a province boundary layer; higher levels can be used for municipal or local cartographic context.

path

Cache directory used to store downloaded GADM files.

ext

GADM file format. The default "json" downloads the level-specific zipped GeoJSON.

version

GADM version string used to build the download URL.

quiet

Passed to sf::st_read().

Details

This helper downloads GADM directly from the public GADM distribution endpoint, caches the file in path, and reads it with sf. It is intended as an optional cartographic support layer for plotting and spatial quality checks. GADM boundaries are not Spanish NFI products and should not be interpreted as official inventory geometries.

Value

An sf object containing the requested GADM administrative boundary layer. Attributes record country, level, version, and URL.

Author(s)

Wilson Lara [aut, cre] (ORCID: <https://orcid.org/0000-0003-3527-1380>), Cristobal Ordonez [aut] (ORCID: <https://orcid.org/0000-0001-5354-3760>), Aitor Vázquez-Veloso [aut] (ORCID: <https://orcid.org/0000-0003-0227-506X>), Felipe Bravo [aut] (ORCID: <https://orcid.org/0000-0001-7348-6695>)

See Also

readNFI_spatial, getNFIboundary_spatial

Examples

if (interactive()) {
    adm <- gadm_spatial("ESP", level = 2, path = tempdir())
    plot(sf::st_geometry(adm))
}

basifoR documentation built on Aug. 26, 2026, 9:06 a.m.