Skip to contents

Preparing training points for remote sensing algorithm

Usage

get_lu_points(
  df,
  year,
  lookup,
  lu_constant = c(),
  nb_pts = 100,
  col_name = "type"
)

Arguments

df

sf data.frame with land use. "type" column should be present.

year

numeric value, year of land use.

lookup

dataframe with "lc1" column for numeric codes and "type" column for text.

lu_constant

vector of strings with land uses to be kept constant in land use (i.e. water, urban areas, etc.)

nb_pts

numeric, number of points per land use/crop class. Optional, default 100.

col_name

string with name of column to be used representing type of crops/land use. Optional, default "type".

Value

sf data.frame with point input for remote sensing training algorithm.

Examples

if (FALSE) {
library(sf)
##Loading land use/crop layer
lu_path <- system.file("extdata", "GIS/lu_layer.shp", package = "svatools")
lu <- st_read(lu_path,  quiet = TRUE)
##Preparing lookup table
lookup <- data.frame(lc1 = seq(1:length(unique(c(lu$type)))), 
type = unique(c(lu$type)))
lu_constant <- c("fesc", "orch", "frst", "frse", "frsd", "urld", "urhd", 
"wetl", "past", "watr", "agrl")
##Getting training points
pts <- get_lu_points(lu, 2021, lookup, lu_constant)
}