matchResolution: Match the resolution of two Raster* objects

Description Usage Arguments Details Value See Also Examples

View source: R/matchResolution.R

Description

Successively projects (if necessary) and resamples a raster coordinate system and spatial resolution to the reference

Usage

1
matchResolution(x, ref, method = "bilinear", filename = "", ...)

Arguments

x

Raster* object or list of Raster* objects.

ref

Reference Raster* object with parameters that x should be resampled to.

method

Character. Method used to compute values for the resampled raster. Can be 'bilinear' for bilinear interpolation or 'ngb' for nearest neighbor interpolation. See resample.

filename

Character. Output file name including path to directory and eventually extension. If x is a list, filename must be a vector of characters with one file name for each element of x. Default is "" (output not written to disk).

...

Other arguments passed to writeRaster

Details

x and ref must have defined CRS (can be assigned using projection). If the CRS don't match, x is projected to ref CRS prior to resampling. x doesn't inherit the extent of ref.

Value

Raster* object or list of Raster* objects.

See Also

resample, projectRaster, projection

Examples

1
2
3
4
5
6
7
8
# Load raster package
library(raster)

# Open ALS metric and Landsat BAP imagery
elev_p95 <- raster(system.file("extdata/examples/ALS_metrics_p95.tif",package="foster"))
BAP_2006 <- stack(system.file("extdata/examples/Landsat_BAP_2006.tif",package="foster"))

matchResolution(x = elev_p95,ref = BAP_2006,method='bilinear')

foster documentation built on March 30, 2021, 5:11 p.m.