# S4 method for Raster,Spatial
fast_extract(x, y, fun = "mean", ...)
# S4 method for Raster,sfc
fast_extract(x, y, fun = "mean", ...)
# S4 method for SpatRaster,sfc
fast_extract(x, y, fun = "mean", ...)
# S4 method for Raster,sf
fast_extract(x, y, fun = "mean", ...)
# S4 method for SpatRaster,sf
fast_extract(x, y, fun = "mean", ...)
Value
A matrix containing the summary amount of each feature
within each planning unit. Rows correspond to different spatial features
in the argument to y and columns correspond to different raster
layers in the argument to x.
character name of statistic to summarize data. Defaults
to "mean". Available options include "sum" or "mean".
Defaults to "mean".
Details
The performance of this function for large terra::rast() objects
can be improved by increasing the GDAL cache size.
The default cache size is 25 MB.
For example, the following code can be used to set the cache size to 4 GB.
terra::gdalCache(size = 4000)
This function is simply a wrapper that uses
exactextractr::exact_extract() for polygon geometries, and
terra::extract() for other geometry types.