Skip to contents

Generate a composite raster from (virtual) raster sources.

Usage

vrt_compute(
  x,
  outfile,
  t_srs,
  te,
  tr,
  resampling,
  engine,
  warp_options,
  creation_options,
  config_options,
  nsplits,
  add_cl_arg,
  quiet
)

# S3 method for class 'vrt_block'
vrt_compute(
  x,
  outfile,
  t_srs = x$srs,
  te = x$bbox,
  tr = x$res,
  resampling = c("near", "bilinear", "cubic", "cubicspline", "lanczos", "average", "rms",
    "mode", "max", "min", "med", "q1", "q3", "sum"),
  engine = c("warp", "gdalraster", "translate"),
  warp_options = gdalwarp_options(),
  creation_options = gdal_creation_options(),
  config_options = gdal_config_opts(),
  nsplits = 1L,
  add_cl_arg = NULL,
  quiet = TRUE
)

# S3 method for class 'vrt_stack_warped'
vrt_compute(
  x,
  outfile,
  t_srs = x$srs,
  te = x$bbox,
  tr = x$res,
  resampling = c("near", "bilinear", "cubic", "cubicspline", "lanczos", "average", "rms",
    "mode", "max", "min", "med", "q1", "q3", "sum"),
  engine = c("warp", "gdalraster", "translate"),
  warp_options = gdalwarp_options(),
  creation_options = gdal_creation_options(),
  config_options = gdal_config_opts(),
  nsplits = 1L,
  add_cl_arg = NULL,
  quiet = TRUE
)

# S3 method for class 'vrt_stack'
vrt_compute(
  x,
  outfile,
  t_srs,
  te,
  tr,
  resampling = c("near", "bilinear", "cubic", "cubicspline", "lanczos", "average", "rms",
    "mode", "max", "min", "med", "q1", "q3", "sum"),
  engine = c("warp", "gdalraster", "translate"),
  warp_options = gdalwarp_options(),
  creation_options = gdal_creation_options(),
  config_options = gdal_config_opts(),
  nsplits = 1L,
  add_cl_arg = NULL,
  quiet = TRUE
)

# S3 method for class 'vrt_collection_warped'
vrt_compute(
  x,
  outfile,
  t_srs = x$srs,
  te = x$bbox,
  tr = x$res,
  resampling = c("near", "bilinear", "cubic", "cubicspline", "lanczos", "average", "rms",
    "mode", "max", "min", "med", "q1", "q3", "sum"),
  engine = c("warp", "gdalraster", "translate"),
  warp_options = gdalwarp_options(),
  creation_options = gdal_creation_options(),
  config_options = gdal_config_opts(),
  nsplits = 1L,
  add_cl_arg = NULL,
  quiet = FALSE
)

# S3 method for class 'vrt_collection'
vrt_compute(
  x,
  outfile,
  t_srs,
  te,
  tr,
  resampling = c("near", "bilinear", "cubic", "cubicspline", "lanczos", "average", "rms",
    "mode", "max", "min", "med", "q1", "q3", "sum"),
  engine = c("warp", "gdalraster", "translate"),
  warp_options = gdalwarp_options(),
  creation_options = gdal_creation_options(),
  config_options = gdal_config_opts(),
  nsplits = 1L,
  add_cl_arg = NULL,
  quiet = FALSE
)

Arguments

x

A vrt_block, vrt_stack, or vrt_collection object

outfile

A character string of the output file path

t_srs

A character string of the target SRS

te

A numeric vector of the target extent in the form c(xmin, ymin, xmax, ymax) and must be the same SRS as in t_srs.

tr

A numeric vector of the target resolution in the form c(xres, yres)

resampling

A character vector of the resampling method to be used. see details.

engine

A character vector of the engine to use for processing the raster data. See details.

warp_options

A character vector of options to pass to gdalwarp

creation_options

A character vector of options to pass to the the gdal "engine".

config_options

A character vector of options to set in the GDAL environment

nsplits

An integer of the number of splits to use when using the gdalraster engine.

add_cl_arg

A character vector of additional command line arguments that are not captured in gdalwarp_options() - these are not checked for validity.

quiet

A logical indicating whether to suppress output

Value

A character string of the path to the output raster

Details

The resampling default is "near", which should be chosen in vrt_warp has already been used but "bilinear" may be prefereable where the input data is has not yet been virtually aligned/resampled.

The choice of engine will depend on the nature of the computation being carried out. In the majority of cases warping is preferred, especically when we are not processing the entirity of the input dataset (as is usually the case when working with online data sources).