% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prepInputsCOG.R
\name{prepInputsCOG}
\alias{prepInputsCOG}
\title{Fast spatial subsetting of Cloud Optimized GeoTiff (COG) files}
\usage{
prepInputsCOG(url, verbose = getOption("reproducible.verbose", 1), ...)
}
\arguments{
\item{url}{Character. An HTTP(S) URL pointing to a GeoTiff file.}

\item{verbose}{Numeric or Logical. Verbosity level.}

\item{...}{Passed through; expected to contain at least one of \code{to}, \code{cropTo},
or \code{maskTo} (a spatial object defining the area of interest).}
}
\value{
A \code{SpatRaster} windowed to the bounding box of the \code{to}/\code{cropTo}/\code{maskTo}
object (in the COG's own CRS), or the character string \code{"NULL"} if any
pre-condition fails (not HTTP, no spatial arg, network error, empty window, etc.).
}
\description{
An alternative fast-path inside \code{\link[=prepInputs]{prepInputs()}} for remote Cloud Optimized GeoTiffs.
When a URL points to a COG and the user has specified a spatial subsetting argument
(\code{to}, \code{cropTo}, or \code{maskTo}), this function reads only the spatial window of interest
via GDAL's \verb{/vsicurl/} virtual filesystem — no full-file download is needed.
The returned \code{SpatRaster} is passed back to \code{prepInputs} where the normal
\code{postProcess} step (mask, reproject, write) completes the pipeline.
}
\details{
This function is called automatically from inside \code{\link[=prepInputs]{prepInputs()}} when
\code{getOption("reproducible.useCOG")} is \code{TRUE} (the default). It can also be
called directly.
}
\seealso{
\code{\link[=prepInputs]{prepInputs()}}, \code{\link[=prepInputsWithTiles]{prepInputsWithTiles()}}
}
