label_landcover: Label landcover layer

View source: R/label_landcover.R

label_landcoverR Documentation

Label landcover layer

Description

Creates a CSV table with landcover codes and labels that can be imported into AccessMod. Requires processed landcover.

Usage

label_landcover(
  mainPath,
  location,
  mostRecent,
  overwrite = FALSE,
  defaultLabels = TRUE
)

Arguments

mainPath

character; the parent directory of the location folder

location

character; the location folder name

mostRecent

logical; should the most recent processed landcover raster 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.

overwrite

logical; in case it exists, should the output be overwritten?

defaultLabels

logical; should the Copernicus default labels be associated with the the landcover raster values. If FALSE, the user is interactively asked to enter the label names for each value.

Details

The function writes a CSV table with two columns (classes and labels) into the same folder as the processed landcover layer.

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) #required for processing the landcover
download_landcover(mainPath, location, alwaysDownload = TRUE, mostRecent = TRUE)
download_population(mainPath, location, alwaysDownload = TRUE) # required for processing the landcover
process_inputs(mainPath, location, "rLandcover", defaultMethods = TRUE, changeRes = FALSE, popCorrection = FALSE)
label_landcover(mainPath, location, mostRecent = TRUE, overwrite = TRUE, defaultLabels = TRUE)
## End(Not run)

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