View source: R/gdalwarp_grid.R
gdalwarp_grid | R Documentation |
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,
dstnodata = NA,
tmpdir = tempdir()
)
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 ( |
dstnodata |
(optional) Set nodata values for output bands
(parameter passed to |
tmpdir |
(optional) Path where intermediate files (.prj) will be created. Default is a temporary directory. |
NULL (the function is called for its side effects)
License: GPL 3.0
Luigi Ranghetti, phD (2019)
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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.cageo.2020.104473")}, URL: https://sen2r.ranghetti.info/.
# 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, useRaster = TRUE)
par(mar = rep(2/3,4))
image(stars::read_stars(ex_ref), useRaster = TRUE)
par(mar = rep(0,4))
image(stars::read_stars(ex_out), rgb = 4:2, maxColorValue = 3500, useRaster = TRUE)
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.