This function is used to spatially predict a trained model on a SpatRaster object with the predictors. Additionally users can opt in to calculate the Area of Applicability based on link{CAST}[aoa].

spatial_predict(
  model,
  predictors,
  AOA = TRUE,
  mode = "raw",
  ncores = 1,
  mask = NULL,
  ...
)

Arguments

model

A model object.

predictors

A spatRaster with the predictor variables.

AOA

A logical indicating if the Area of Applicability shall be calculated. Defaults to FALSE. Can be quite a costly calculation. Check the documentation of link{CAST}[aoa] for possible speed ups via the ... arguments, i.e. through parallel computation.

mode

A character vector indicating the behavior of link{terra}[predict]. If type = "raw" one raster layer with the predicted class is returned. If the model is a regression model the type cannot be set to "proba". If type = "proba" for each outcome class a single layer is returned indicating the probability of a pixel to be classified as that respective class.

ncores

An integer specifying the number of cores to be used for parallel computations.

mask

A spatRaster object with at the same resoultion as the predictor stack. All raster cells unqual to NA will be masked out of the predictor stack to omit predictions at these locations

...

Additional arguments used for link{terra}[predict] and link{CAST}[aoa].

Value

A SpatRaster object with at least one layer which is the classification result. Depending if and how the AOA is calculated two additional layers are possible representing the AOA itself and the DI. Check link{CAST}[aoa] for more information.

Author

Darius Görgen (MapTailor Geospatial Consulting GbR) info@maptailor.net
Maintainer: MAPME-Initiative contact@mapme-initiative.org
Contact Person: Dr. Johannes Schielein
Copyright: MAPME-Initiative
License: GPL-3