R/prepInputsCOG.R
prepInputsCOG.RdAn alternative fast-path inside prepInputs() for remote Cloud Optimized GeoTiffs.
When a URL points to a COG and the user has specified a spatial subsetting argument
(to, cropTo, or maskTo), this function reads only the spatial window of interest
via GDAL's /vsicurl/ virtual filesystem — no full-file download is needed.
The returned SpatRaster is passed back to prepInputs where the normal
postProcess step (mask, reproject, write) completes the pipeline.
prepInputsCOG(url, verbose = getOption("reproducible.verbose", 1), ...)A SpatRaster windowed to the bounding box of the to/cropTo/maskTo
object (in the COG's own CRS), or the character string "NULL" if any
pre-condition fails (not HTTP, no spatial arg, network error, empty window, etc.).
This function is called automatically from inside prepInputs() when
getOption("reproducible.useCOG") is TRUE (the default). It can also be
called directly.