% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/esdb-raster.R
\name{lookup_esdb}
\alias{lookup_esdb}
\title{Look up an ESDB raster value at WGS84 coordinates}
\usage{
lookup_esdb(coords, attribute, raster_root, decode = TRUE)
}
\arguments{
\item{coords}{A two-column matrix or data.frame with `lon` and
`lat` (WGS84 decimal degrees) -- in that order. A single
\code{c(lon, lat)} vector is also accepted.}

\item{attribute}{Name of the ESDB attribute folder, e.g.
\code{"WRBLV1"} or \code{"WRBFU"}. See
\code{\link{available_esdb_attributes}}.}

\item{raster_root}{Path to the unpacked ESDB raster directory.}

\item{decode}{If \code{TRUE} (default), decode the integer raster
value to the VAT-coded string (e.g. \code{"21"} ->
\code{"LV"}). If \code{FALSE}, return the raw integer.}
}
\value{
Character vector (decoded codes) or numeric vector (raw
        values) of the same length as \code{nrow(coords)}.
        \code{NA} for points outside the raster footprint.
}
\description{
Loads the requested attribute raster, reprojects WGS84 lat/lon
input to the raster's native CRS (typically LAEA Europe,
EPSG:3035), and extracts the value(s). When a Value Attribute
Table (`.vat.dbf`) is available, the integer raster value is
decoded to its coded string (e.g. `21` -> `"LV"` -> Luvisol).
}
\details{
Coordinates outside the European raster footprint return `NA`
silently (rather than erroring) so vectorised calls degrade
gracefully.
}
\examples{
\donttest{
root <- file.path(tempdir(), "ESDB-Raster-Library-1k-GeoTIFF-20240507")
if (dir.exists(root) && requireNamespace("terra", quietly = TRUE)) {
  # Single point: Wageningen, Netherlands (5.66 E, 51.97 N)
  lookup_esdb(c(5.66, 51.97), "WRBLV1", root)

  # Vector: Lisbon + Berlin + Helsinki
  coords <- rbind(c(-9.14, 38.72), c(13.40, 52.52), c(24.94, 60.17))
  lookup_esdb(coords, "WRBLV1", root)
}
}
}
\seealso{
\code{\link{available_esdb_attributes}}
}
