The function applies gdalwarp to build rasters with the same projection, resolution and grid alignment of another raster. If not specified, the output format of each file is the same of the corresponding source file.

gdalwarp_grid(srcfiles, dstfiles, ref, of = NULL, r = NULL, tmpdir = tempdir())

Arguments

srcfiles

A vector of input file paths (managed by GDAL).

dstfiles

A vector of input file paths.

ref

Path of the raster taken as reference.

of

The output format (use the short format name). Default is the format of every input filename.

r

Resampling_method ("near"|"bilinear"|"cubic"|"cubicspline"| "lanczos"|"average"|"mode"|"max"|"min"|"med"|"q1"|"q3").

tmpdir

(optional) Path where intermediate files (.prj) will be created. Default is a temporary directory.

Value

NULL (the function is called for its side effects)

Note

License: GPL 3.0

References

L. Ranghetti, M. Boschetti, F. Nutini, L. Busetto (2020). "sen2r": An R toolbox for automatically downloading and preprocessing Sentinel-2 satellite data. Computers & Geosciences, 139, 104473. DOI: 10.1016/j.cageo.2020.104473, URL: http://sen2r.ranghetti.info/.

Examples

# \donttest{ # Define file names ex_sel <- system.file( "extdata/out/S2A2A_20190723_022_Barbellino_BOA_10.tif", package = "sen2r" ) ex_ref <- system.file( "extdata/out/S2A2A_20190723_022_Barbellino_SCL_10.tif", package = "sen2r" ) ex_out <- tempfile(fileext = "_BOA_out.tif") # Run function sen2r:::gdalwarp_grid(ex_sel, ex_out, ref = ex_ref) # Show output oldpar <- par(mfrow = c(1,3), mar = rep(0,4)) image(stars::read_stars(ex_sel), rgb = 4:2, maxColorValue = 3500) par(mar = rep(2/3,4)); image(stars::read_stars(ex_ref)) par(mar = rep(0,4)); image(stars::read_stars(ex_out), rgb = 4:2, maxColorValue = 3500)
par(oldpar) # }