extract_values: Extract buffer values

View source: R/create_training_data.R

extract_valuesR Documentation

Extract buffer values

Description

Extracts values for all layers of a raster for a set of points or polygons. If

Usage

extract_values(
  raster,
  points,
  extraction_method = "all",
  extraction_layer = NULL,
  return_type = "table",
  na.rm = TRUE,
  ...
)

Arguments

raster

A SpatRaster of explanatory variables with a layer for each variable to extract.

points

SpatVector of points to use for extraction. If polygons, the point chosen for extraction will be determined via the extraction_method parameter.

extraction_method

Method to use for extracting values from each point: "all", "centroid", "max", or "min". Ignored if extractionPoints is not polygon

extraction_layer

Layer to use for extracting value. Ignored if extraction_method = "centroid". Ignored if extraction_method is "all" or "centroid" or if extractionPoints is not polygon.

return_type

"table" or "points". If "table" (default) a data.table with values is returned. if "points", a SpatVector of points is returned, with training values as attributes for each point.

na.rm

Remove any cells with NA values?

...

Additional arguments passed onto terra::extrac

Value

A dataframe of extracted raster values with an additional "class" column.


tabrasel/WetlandTools documentation built on Dec. 20, 2024, 8:50 a.m.