Get geopackage format map of a specific country from GADM.

get_geopackage(country, version = "gadm3.6", layer)

Arguments

country

Three-letter ISO country code. Corresponding three-letter ISO code for each country can be found in the list_countries dataset.

version

A character vector specifying the GADM version from which to get the geopackage download from. Default is gadm3.6 for current version of GADM.

layer

A numeric value specifying which layer from geopackage to get. A layer corresponds to the different administrative units of the specific country where 0 is country-level, 1 is the first administrative level (usually region, state, province), 2 is the second administrative level (usually district, locality, municipality) and so on and so forth.

Value

SpatialPolygonsDataFrame of the specified country map layer.

Examples

get_geopackage(country = "AFG", layer = 0)
#> OGR data source with driver: GPKG #> Source: "/private/var/folders/rx/nr32tl5n6f3d_86tn0tc7kc00000gp/T/Rtmp5nVm1m/gadm36_AFG.gpkg", layer: "gadm36_AFG_2" #> with 328 features #> It has 13 fields
#> class : SpatialPolygonsDataFrame #> features : 328 #> extent : 60.50487, 74.89413, 29.36157, 38.49092 (xmin, xmax, ymin, ymax) #> crs : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 #> variables : 13 #> names : GID_0, NAME_0, GID_1, NAME_1, NL_NAME_1, GID_2, NAME_2, VARNAME_2, NL_NAME_2, TYPE_2, ENGTYPE_2, CC_2, HASC_2 #> min values : AFG, Afghanistan, AFG.1_1, Badakhshan, NA, AFG.1.1_1, Ab Band, Archi, NA, Wuleswali, District, NA, AF.BD.BA #> max values : AFG, Afghanistan, AFG.9_1, Zabul, NA, AFG.9.9_1, Zurmat, Ziruk, NA, Wuleswali, District, NA, AF.ZB.TJ