download_population: Download Population Raster

download_populationR Documentation

Download Population Raster

Description

Download a population raster from the World Pop FTP and copy it to its corresponding folder.

Usage

download_population(
  mainPath,
  location,
  alwaysDownload = FALSE,
  allowInteractivity = TRUE,
  testMode = FALSE
)

Arguments

mainPath

character; the parent directory of the location folder

location

character; the location folder name

alwaysDownload

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

allowInteractivity

logical; whether to enable interactivity. TRUE by default. When is FALSE, alwaysDownload is automatically set to TRUE. When FALSE, UNAdj constrained population raster is downloaded, and when available, maxar_v1 images are prioritized over BSGM images.

testMode

logical; to be ignored. Only used when testing the function with testthat.

Details

The function accesses the World Pop FTP and uses an internal function (navigate_ftp) in order to interactively navigate through the folders and select the population raster to be downloaded. The ISO code retrieved internally by the get_param function is used to match the country FTP folder when available. When allowInteractivity = FALSE, predefined parameters are set (see parameter details.)

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_population(mainPath, location, alwaysDownload = TRUE)
## End(Not run)

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