
Align a terra::SpatRaster object to another by harmonizing geometry and extend.
Source: R/utils-spatial.R
alignRasters.RdIf the data is not in the same projection as the template, the alignment will be computed by reprojection only. If the data has already the same projection, the data set will be cropped and aggregated prior to resampling in order to reduce computation time.
Arguments
- data
terra::SpatRasterobject to be resampled.- template
terra::SpatRasterorsf::sfobject from which geometry can be extracted.- method
method for resampling (Options:
"near"or"bilinear").- func
function for resampling (Default: mean).
- cl
logicalvalue if multicore computation should be used (Default:TRUE).
Value
New terra::SpatRaster object aligned to the supplied template layer.
Details
Nearest Neighbour resampling (near) is recommended for discrete and bilinear resampling recommended for continuous data. See also help from terra::resample for other options.