% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spatial-lookups.R
\name{lookup_soilgrids}
\alias{lookup_soilgrids}
\title{Look up a SoilGrids 250m soil property at WGS84 coordinates}
\usage{
lookup_soilgrids(
  coords,
  property = c("clay", "sand", "silt", "phh2o", "soc", "cec", "bdod", "nitrogen", "ocd",
    "ocs", "cfvo"),
  depth = c("0-5cm", "5-15cm", "15-30cm", "30-60cm", "60-100cm", "100-200cm"),
  quantile = c("mean", "Q0.05", "Q0.5", "Q0.95", "uncertainty"),
  baseurl = "https://files.isric.org/soilgrids/latest/data",
  raw = FALSE
)
}
\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{property}{One of the SoilGrids 250m predicted properties:
\code{"clay"}, \code{"sand"}, \code{"silt"},
\code{"phh2o"}, \code{"soc"}, \code{"cec"},
\code{"bdod"}, \code{"nitrogen"}, \code{"ocd"},
\code{"ocs"}, \code{"cfvo"}.}

\item{depth}{Depth interval. One of \code{"0-5cm"},
\code{"5-15cm"}, \code{"15-30cm"}, \code{"30-60cm"},
\code{"60-100cm"}, \code{"100-200cm"}.}

\item{quantile}{Output quantile. One of \code{"mean"} (default),
\code{"Q0.05"}, \code{"Q0.5"}, \code{"Q0.95"},
\code{"uncertainty"}.}

\item{baseurl}{Base URL of the SoilGrids COG endpoint. Default
is the canonical ISRIC location; override only for a
local mirror.}

\item{raw}{If \code{TRUE}, returns the integer raster value
without scaling. Default \code{FALSE} (returns the value
in conventional units).}
}
\value{
Numeric vector of length \code{nrow(coords)}. \code{NA}
        outside the SoilGrids footprint or on network errors.
}
\description{
Reads ISRIC SoilGrids 250m (Hengl et al. 2017, 2021) directly
from the ISRIC Cloud-Optimized GeoTIFF (COG) endpoint at
\code{https://files.isric.org/soilgrids/latest/data/} -- no
download required, only the pixel under each query coordinate is
transferred over HTTPS.
}
\details{
SoilGrids stores integer rasters scaled per property; this helper
applies the canonical conversion factor so the returned value is
in conventional soil units (\%, pH, g/kg, cmol(c)/kg, g/cm^3).
}
\examples{
\dontrun{
# Single point
lookup_soilgrids(c(-43.0, -22.0),
                  property = "phh2o",
                  depth = "0-5cm",
                  quantile = "mean")

# Vector + multiple properties
coords <- rbind(c(-43.0, -22.0), c( -9.14, 38.72))
lookup_soilgrids(coords, "clay",  "0-5cm", "mean")
lookup_soilgrids(coords, "phh2o", "0-5cm", "mean")
}
}
\seealso{
\code{\link{lookup_esdb}},
         \code{\link{lookup_mapbiomas_solos}}.
}
