Construct A warped VRT or warped VRT collection.
Usage
vrt_warp(x, t_srs, te, tr, resampling, quiet)
# S3 method for class 'vrt_block'
vrt_warp(
x,
t_srs,
te,
tr,
resampling = c("bilinear", "near", "cubic", "cubicspline", "lanczos", "average", "rms",
"mode", "max", "min", "med", "q1", "q3", "sum"),
quiet = TRUE
)
# S3 method for class 'vrt_collection'
vrt_warp(
x,
t_srs,
te,
tr,
resampling = c("bilinear", "near", "cubic", "cubicspline", "lanczos", "average", "rms",
"mode", "max", "min", "med", "q1", "q3", "sum"),
quiet = TRUE
)
Arguments
- x
A vrt_collection or vrt_block (most likely the former).
- t_srs
character target SRS must be a numeric EPSG code, or SRS like character such as a proj4 string or WKT.
- te
numeric vector of the target extent in the form c(xmin, ymin, xmax, ymax) using the same SRS as in
t_srs
.- tr
numeric vector of the target resolution in the form c(xres, yres)
- resampling
character vector of the resampling methods to be used for each band. The default is "bilinear". "near" sampling will be used for the mask_band if provided.
- quiet
logical indicating whether to suppress progress bar.
Details
This function generates warped VRT objects types. This is particularly useful when we want to create a vrt_stack but our input images span multiple spatial reference systems. In such a situation, before warping our input data we must align with our desired oputput grid.
Examples
s2files <- fs::dir_ls(system.file("s2-data", package = "vrtility"))
ex_collect <- vrt_collect(s2files)
t_block <- ex_collect[[1]][[1]]
vrt_warp(
ex_collect,
t_srs = t_block$srs,
te = t_block$bbox,
tr = t_block$res
)
#> → <VRT Collection>
#>
#> VRT SRS:
#> PROJCS["unknown",GEOGCS["unknown",DATUM["Unknown based on WGS 84 ellipsoid",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]]],PROJECTION["Lambert_Azimuthal_Equal_Area"],PARAMETER["latitude_of_center",50.72],PARAMETER["longitude_of_center",-3.51],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1],AXIS["Easting",EAST],AXIS["Northing",NORTH]]
#>
#>
#> Bounding Box: -3540 -3340 3540 3340
#> Pixel res: 20, 20
#> Start Date: NA
#> End Date: NA
#> Number of Items: 5
#> Assets: B02, B03, B04, SCL