% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tbl.R
\name{tiff_extract_points}
\alias{tiff_extract_points}
\title{Extract raster values at point coordinates}
\usage{
tiff_extract_points(path, x, y = NULL)
}
\arguments{
\item{path}{Path to a GeoTIFF file.}

\item{x}{Numeric vector of x coordinates, or a data.frame / matrix with
columns named \code{x} and \code{y}.}

\item{y}{Numeric vector of y coordinates (ignored if \code{x} is a data.frame).}
}
\value{
A data.frame with columns \code{x}, \code{y}, \code{band1}, \code{band2}, etc.
One row per input point, in the same order as the input.
}
\description{
Samples band values from a GeoTIFF at specific (x, y) locations using the
file's affine geotransform. Only the strips containing query points are read,
making this efficient for sparse point sets on large rasters.
}
\details{
Points that fall outside the raster extent return \code{NA} for all bands.
Pixel assignment uses nearest-pixel rounding (i.e., the point is assigned to
the pixel whose center is closest).
}
\examples{
\donttest{
f <- tempfile(fileext = ".tif")
df <- data.frame(x = as.double(rep(1:4, 3)),
                 y = as.double(rep(1:3, each = 4)),
                 band1 = as.double(1:12))
write_tiff(df, f)

# Sample at specific locations via data.frame
pts <- data.frame(x = c(2, 3), y = c(1, 2))
tiff_extract_points(f, pts)

# Or pass x and y separately
tiff_extract_points(f, x = c(2, 3), y = c(1, 2))
unlink(f)
}

}
