Skip to contents

If 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.

Usage

alignRasters(data, template, method = "bilinear", func = mean, cl = TRUE)

Arguments

data

SpatRaster object to be resampled.

template

SpatRaster or sf object from which geometry can be extracted.

method

method for resampling (Options: "near" or "bilinear").

func

function for resampling (Default: mean).

cl

logical value if multicore computation should be used (Default: TRUE).

Value

New 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.

Examples

if (FALSE) { # \dontrun{
 # Align one raster to another
 ras1 <- alignRasters( ras1, ras2, method = "near", cl = FALSE)
} # }