download_boundaries: Download Administrative Boundaries

download_boundariesR Documentation

Download Administrative Boundaries

Description

Download the administraive boundary shapefile from geoboundaries and copy it to its corresponding folder.

Usage

download_boundaries(
  mainPath,
  location,
  adminLevel,
  type = "gbAuthoritative",
  alwaysDownload = FALSE
)

Arguments

mainPath

character; the parent directory of the location folder

location

character; the location folder name

adminLevel

integer; administrative level of the boundaries. From 0 to 3.

type

character; data type. Can be 'gbOpen' for geoBoundaries data, 'gbHumanitarian' for UN OCHA CODs data, or 'gbAuthoritative' for UN SALB data (default).

alwaysDownload

logical; should the administrative boundaries always be downloaded, even if they have already been downloaded? If FALSE and if the administrative boundary shapefile has already been downloaded the user is interactively asked whether they want to download it again or not.

Details

The ISO code used to download the shapefile is retrieved by the internal get_param function. Another internal function will query the geoBoundaries database (geoboundaries_query) to check availability and retrieve a json file that contains the download link.

References

Runfola, D. et al. (2020) geoBoundaries: A global database of political administrative boundaries. PLoS ONE 15(4): e0231866. https://doi.org/10.1371/journal.pone.0231866

Examples

# Replace workDir with the actual path to your working directory
## Not run: 
mainPath <- "workDir"
initiate_project(mainPath)
## End(Not run)

# Replace myLocation with the location name you are working on (workDir subfolder)
## Not run: 
location <- "myLocation"
download_boundaries(mainPath, location, adminLevel = 1, type = "gbOpen", alwaysDownload = TRUE)
## End(Not run)

ptimoner/inAccMod documentation built on Jan. 27, 2025, 9:34 a.m.