process_inputs: Process Input Layers

process_inputsR Documentation

Process Input Layers

Description

Process any input layer and copy it to its corresponding folder

Usage

process_inputs(
  mainPath,
  location,
  selectedInputs = NULL,
  mostRecent = FALSE,
  alwaysProcess = FALSE,
  defaultMethods = NULL,
  changeRes = NULL,
  newRes = NULL,
  popCorrection = NULL,
  gridRes = NULL,
  allowInteractivity = TRUE,
  testMode = FALSE
)

Arguments

mainPath

character; the parent directory of the location folder

location

character; the location folder name

selectedInputs

character; vector indicating the inputs to be processed. Raw inputs must be available. Argument can be set to "All" to consider all the available 'raw' inputs. If NULL, the user is interactively asked to select the available inputs to be processed.

mostRecent

logical; should the most recent input be selected? If FALSE and if there are multiple available inputs, the user is interactively asked to select the input based on file creation time.

alwaysProcess

logical; should always the input be processed? If alwaysProcess = FALSE and if the input has already been processed, the user is interactively asked whether they want to process it or not.

defaultMethods

logical; should be the default methods be used for projecting and resampling, respectively. For the population raster, these are the 'bilinear' method for projecting and the 'sum' or the 'bilinear' for the resampling, depending on if the new resolution is lower or higher. For the landcover raster, the 'near' method is used for both the projection and resampling. For the the DEM, the 'bilinear' method is used for both the projection and resampling. If FALSE, the user is interactively asked to choose the methods from a list of options.

changeRes

logical; does the user want to change the raster resolution of the population raster? If NULL, the resolution is printed and it is interactively asked the user if they want to change it. IF FALSE, there is no resampling.

newRes

numeric; new resolution in meters. Ignored if the changeRes is FALSE. If NULL and if changeRes is TRUE, the user is interactively asked to provide the new resolution.

popCorrection

logical; should the raster correction algorithm be run. If it is NULL, the user is interactively asked whether they want to run it or not.

gridRes

numeric; the resolution (meters) of the grid shapefile used for correcting the raster. Ignored if popCorrection is FALSE. If NULL and popCorrection is TRUE, the user is interactively asked to provide the grid resolution.

allowInteractivity

logical; if TRUE, the user can choose a label for each processed layer; if FALSE, label default is used ('pr')

testMode

logical; used for testing. If TRUE labels of processed inputs are not interactively asked.

Details

A 'processed' boundary shapefile is required for processing any other inputs. A 'processed' population raster is required for processing any other raster. These conditions are taken into account and the processing of these layers is performed even if they are not selected and if 'processed' layers are not available.

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)
set_projection(mainPath, location, mostRecent = TRUE, alwaysSet = TRUE, bestCRS = TRUE)
download_landcover(mainPath, location, alwaysDownload = TRUE, mostRecent = TRUE)
download_population(mainPath, location, alwaysDownload = TRUE)
download_dem(mainPath, location, alwaysDownload = TRUE, mostRecent = TRUE)
download_osm(mainPath, location, type = "roads", alwaysDownload = TRUE, mostRecent = NULL, defaultClasses = TRUE)
download_osm(mainPath, location, type = "waterLines", alwaysDownload = TRUE, mostRecent = NULL, defaultClasses = TRUE)
download_osm(mainPath, location, type = "waterPolygons", alwaysDownload = TRUE, mostRecent = NULL, defaultClasses = TRUE)
process_inputs(mainPath, location, selectedInputs = "All", mostRecent = TRUE, alwaysProcess = TRUE, defaultMethods = TRUE, changeRes = FALSE, popCorrection = TRUE, gridRes = 3000)
## End(Not run)

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