An 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), ...)

Arguments

url

Character. An HTTP(S) URL pointing to a GeoTiff file.

verbose

Numeric or Logical. Verbosity level.

...

Passed through; expected to contain at least one of to, cropTo, or maskTo (a spatial object defining the area of interest).

Value

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.).

Details

This function is called automatically from inside prepInputs() when getOption("reproducible.useCOG") is TRUE (the default). It can also be called directly.