get_gadm: Download GADM 3.6 data in all available format.

View source: R/get_gadm.R

get_gadmR Documentation

Download GADM 3.6 data in all available format.

Description

Download GADM 3.6 data in all available format.

Usage

get_gadm(
  country,
  level = 0,
  path = ".",
  format = c("sf", "sp", "kmz", "shp", "gpkg")
)

Arguments

country

ISO3 code of a country, use "?" to get the full list of codes.

level

administrative level, level = 0 download administrative boundaries for the entire country. Note that maximum value taken varies among countries (5 is the maximum value encountered).

path

path to the folder where files will be stored.

format

either "sf", "sp", "kmz", "shp" or "gpkg" (see details).

Details

  • "sf" downloads a .rds file containing an object of class SpatialPolygonsDataFrame.

  • "sp" downloads a .rds file containing an object of class sf.

  • "kmz" downloads a .kmz (Keyhole Markup language Zipped) file.

  • "shp" download an archive zip containing one ESRI shapefiles per level available.

  • "gpkg" downloads an archive zip containing a GeoPackage file including all available levels.

Note that if a specific level does not exist, an HTTP error 404 will be returned for the first group of files whereas for the second group the archive will still be downloaded but a error will be thrown when attempting reading a level that does not exist.

Value

A "SpatialPolygonsDataFrame" object if format = "sp", otherwise an object of class sf.

References

https://gadm.org/

Examples

## Not run: 
can <- get_gadm("CAN", level = 1, format = "sf")
bel <- get_gadm("BEL", format = "gpkg")

## End(Not run)

inSileco/inSilecoDataRetrieval documentation built on July 7, 2023, 10:13 p.m.