% 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{
\donttest{
if (requireNamespace("chromote", quietly = TRUE) && interactive()) {
  out_dir <- file.path(tempdir(), "bdsolos")
  dir.create(out_dir, showWarnings = FALSE, recursive = TRUE)

  # Single UF (fast, recommended)
  download_bdsolos(file.path(out_dir, "RJ.csv"),
                    accept_terms = TRUE,
                    filter_uf    = "RJ")

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

  # Then load all of them
  csvs <- list.files(out_dir, "\\\\.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}}.
}
