Get shapefile format map of a specific country from GADM.

get_shapefile(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_shapefile(country = "AFG", layer = 0)
#> OGR data source with driver: ESRI Shapefile #> Source: "/private/var/folders/rx/nr32tl5n6f3d_86tn0tc7kc00000gp/T/Rtmp5nVm1m", layer: "gadm36_AFG_0" #> with 1 features #> It has 2 fields
#> class : SpatialPolygonsDataFrame #> features : 1 #> 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 : 2 #> names : GID_0, NAME_0 #> value : AFG, Afghanistan