getGADM: Function to download GADM data for a country at a specific...

View source: R/getGADM.R

getGADMR Documentation

Function to download GADM data for a country at a specific level

Description

This function downloads the GADM shapefile for a country (https://gadm.org/data.html). If the file is already on disk it will not perform the download. The function can check if better resolutions are available in disk.

Usage

getGADM(cod, level = 4, type = "sf", best = FALSE, destfolder = "GADM", ...)

Arguments

cod

Three letter ISO code for the country.

level

Administrative level. 0 stands for country and 1 to 4 are the successive successive nested levels. Not every country has the same depth and the nestedness is sequential. This means a country with two levels has levels 0 and 1, not 0 and 4, and that units such as states or municipalities can correspond to different levels depending on the country

type

The class of spatial object to be downloaded. Defaults to "sf" but can be set to "sp"

best

TRUE Checks if finer resolutions are available and avoids downloading data at coarser resolutions. Defaults to TRUE (will not download coarser resolution files)

destfolder

The destination folder

...

Options for download.file()

Details

https://gadm.org/data.html

Author(s)

Andrea Sánchez-Tapia & Sara Mortara

Examples

## Not run: 
getGADM(cod = "BRA", level = 0)
getGADM(cod = "BRA", level = 1, best = TRUE) # will not download if lower levels exist
getGADM(cod = "BRA", level = 3, type = "sp")

## End(Not run)


saramortara/rocc documentation built on April 3, 2022, 3:41 p.m.