% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spatial-lookups.R
\name{lookup_mapbiomas_solos}
\alias{lookup_mapbiomas_solos}
\title{Look up a MapBiomas Solos raster value at WGS84 coordinates}
\usage{
lookup_mapbiomas_solos(coords, raster_path, legend = NULL)
}
\arguments{
\item{coords}{A 2-column matrix or data.frame with \code{lon},
\code{lat} (WGS84 decimal degrees), or a length-2 numeric
vector for a single query.}

\item{raster_path}{Path to the unpacked MapBiomas Solos GeoTIFF.}

\item{legend}{Optional two-column data.frame
(first column = numeric value, second = SiBCS class name).
When provided, the integer raster value is decoded; when
\code{NULL}, the raw integer is returned.}
}
\value{
Character vector of decoded class names (when
        \code{legend} is supplied) or numeric vector of raster
        values. Same length as \code{nrow(coords)}. \code{NA}
        for points outside the raster footprint.
}
\description{
MapBiomas Solos (Project MapBiomas, Brazil) distributes a national
raster of SiBCS classes at 30 m, downloadable from
\url{https://mapbiomas.org/en/produtos}. This helper mirrors the
shape of \code{\link{lookup_esdb}} but is local-file only: pass
the path of the unpacked GeoTIFF and the function reprojects the
user's WGS84 lat/lon to the raster's native CRS, extracts the
pixel and (optionally) decodes the integer class code via a
user-supplied legend.
}
\details{
MapBiomas does not bundle a `.vat.dbf`; the canonical legend is
published as a CSV / dictionary on their website. Pass it via
\code{legend} as a two-column data.frame
(\code{value, class_name}) to enable decoding.
}
\examples{
\donttest{
tif <- file.path(tempdir(), "mapbiomas_solos_collection2_2023.tif")
if (file.exists(tif)) {
  legend <- data.frame(
    value = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L),
    class_name = c("Latossolo Vermelho-Amarelo",
                     "Latossolo Amarelo",
                     "Argissolo Vermelho-Amarelo",
                     "Argissolo Amarelo",
                     "Neossolo Quartzarenico",
                     "Cambissolo Haplico",
                     "Espodossolo",
                     "Gleissolo",
                     "Nitossolo",
                     "Planossolo",
                     "Plintossolo",
                     "Vertisolo",
                     "Outros")
  )
  lookup_mapbiomas_solos(c(-43.0, -22.0), tif, legend)
}
}
}
\seealso{
\code{\link{lookup_esdb}}, \code{\link{lookup_soilgrids}}.
}
