% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bdsolos.R
\name{download_bdsolos}
\alias{download_bdsolos}
\title{Download the BDsolos consulta-publica CSV (experimental, requires chromote)}
\usage{
download_bdsolos(
  out_path,
  accept_terms = FALSE,
  filter_uf = NULL,
  attributes = "default",
  timeout_seconds = 600,
  chromote_session = NULL,
  verbose = TRUE
)
}
\arguments{
\item{out_path}{File path for the downloaded CSV.}

\item{accept_terms}{Logical. Must be \code{TRUE} to proceed; the
function aborts otherwise. Documents informed consent to
the BDsolos terms (personal/academic use, ABNT citation).}

\item{filter_uf}{Optional 2-letter UF code (e.g. \code{"RJ"},
\code{"SC"}). Strongly recommended -- the full-table query
often times out.}

\item{attributes}{Character vector. Which attribute groups to
request. Defaults to the full SiBCS-classification-relevant
set (Identificacao + Localizacao + Classificacao for Pontos
de Amostragem, Identificacao + Morfologicas + Fisicas +
Quimicas for Horizontes; Mineralogicas excluded for
performance). Pass \code{"all"} to include Mineralogicas.}

\item{timeout_seconds}{Total timeout for the AJAX query.
Default 600 (10 min).}

\item{chromote_session}{Optional pre-built \code{chromote::ChromoteSession}.
Useful to share a session across calls.}

\item{verbose}{If \code{TRUE} (default), prints progress.}
}
\value{
File path to the downloaded CSV (invisible).
}
\description{
Drives the Embrapa BDsolos web form via headless Chrome
(\code{chromote}) to produce a CSV of all profiles + all attributes.
Marked **experimental**: heavy queries (no UF filter) frequently
overload the Embrapa server. Prefer \code{filter_uf =} batches of
one or two states at a time and stitch the resulting CSVs.
}
\details{
Per the Embrapa terms-of-use, the data is licensed for personal /
academic use and publications must cite the source per ABNT.
\strong{Set \code{accept_terms = TRUE} to acknowledge this and let
the function click "Concordo" on your behalf.}
}
\examples{
\dontrun{
# Single UF (fast, recommended)
download_bdsolos("soil_data/bdsolos/RJ.csv",
                  accept_terms = TRUE,
                  filter_uf    = "RJ")

# Stitch multiple UFs
for (uf in c("RJ", "SP", "MG", "ES")) {
  download_bdsolos(file.path("soil_data/bdsolos",
                               paste0(uf, ".csv")),
                    accept_terms = TRUE, filter_uf = uf)
}

# Then load all of them
csvs <- list.files("soil_data/bdsolos", "\\\\.csv$", full.names = TRUE)
all_pedons <- unlist(lapply(csvs, load_bdsolos_csv), recursive = FALSE)
length(all_pedons)
}
}
\seealso{
\code{\link{load_bdsolos_csv}},
         \code{\link{inspect_bdsolos_csv}}.
}
