Skip to contents

This function preprocesses land cover data for visualization, calculation, and summarization. It checks the consistency of input data, creates visualizations of input data, calculates land cover frequency, creates a crosstabulation of land cover changes, and summarizes results at both the landscape and planning unit level. The function also converts pixels to hectares if convert_to_Ha is set to TRUE.

Usage

ques_pre(
  lc_t1,
  lc_t2,
  admin_,
  cutoff_landscape = 5000,
  cutoff_pu = 500,
  convert_to_Ha = TRUE
)

Arguments

lc_t1

A spatRaster object representing land cover data for period T1.

lc_t2

A spatRaster object representing land cover data for period T2.

admin_

A spatRaster object representing planning unit data. Can also be a sf multipolygon object, in which case it will be rasterized.

cutoff_landscape

minimum number of pixel/ area to be displayed in sankey plot at landscape level

cutoff_pu

minimum number of pixel/ area to be displayed in sankey plot at planing unit level

convert_to_Ha

Logical flag indicating whether to convert pixel count to hectares based on the resolution of the lc_t1 raster.

Value

A list of results containing input data visualizations, landscape level results, and planning unit level results.

Examples

if (FALSE) {
# Load and annotate land cover data for period T1
lc_t1_ <- LUMENSR_example("NTT_LC90.tif") %>%
  terra::rast() %>%
  add_legend_to_categorical_raster(
    raster_file = .,
    lookup_table = lc_lookup_klhk_sequence,
    year = 1990)

# Load and annotate land cover data for period T2
  terra::rast() %>%
  add_legend_to_categorical_raster(
    raster_file = .,
    lookup_table = lc_lookup_klhk_sequence,
   year = 2020)

# Load planning unit data
admin_z <- LUMENSR_example("ntt_admin_spatraster.tif") %>%
  terra::rast()
ques_pre(lc_t1_, lc_t2_, admin_z)
}