% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sentinelhub.R
\name{dse_sh_process}
\alias{dse_sh_process}
\title{Process Satellite Data and Download Result}
\usage{
dse_sh_process(
  input,
  output,
  evalscript,
  destination,
  ...,
  token = dse_access_token()
)
}
\arguments{
\item{input}{A named \code{list} specifying the input satellite data to
be processed with \code{evalscript} to an image. A correctly formatted
\code{list} can be created with \code{\link[=dse_sh_prepare_input]{dse_sh_prepare_input()}}.}

\item{output}{A named \code{list} specifying the how to present the output
image, create with \code{evalscript}. A correctly formatted \code{list} can be
created with \code{\link[=dse_sh_prepare_output]{dse_sh_prepare_output()}}.}

\item{evalscript}{A \code{character} string containing a piece of JavaScript,
that will be run on the Sentinel Hub server. It is used to translate
satellite data to pixel data in a geo-referenced image. For more information
on setting up such a script please consult
\href{https://docs.sentinel-hub.com/api/latest/evalscript/}{the API documentation}.
You can also use \code{\link[=dse_sh_get_custom_script]{dse_sh_get_custom_script()}} to obtain ready-to-go
scripts from the SentinelHub repository.}

\item{destination}{A file name to store the downloaded image.}

\item{...}{Ignored}

\item{token}{For authentication, many of the Data Space Ecosystem uses
an access token. Either provide your access token, or obtain one automatically
with \code{\link[=dse_access_token]{dse_access_token()}} (default). Without a valid token you will likely get
an "access denied" error.}
}
\value{
A \code{httr2_response} class object containing the
location of the downloaded file at its \code{destination}.
}
\description{
Users can request raw satellite data, simple band combinations such
as false colour composites, calculations of simple remote sensing
indices like NDVI, or more advanced processing such as calculation
of Leaf area index (LAI).
}
\details{
Use \code{\link[=dse_sh_use_requests_builder]{dse_sh_use_requests_builder()}} if you want to use the graphical
user interface at
\href{https://shapps.dataspace.copernicus.eu/requests-builder/}{Sentinel Requests Builder}.
to define a request.
}
\examples{
if (interactive() && dse_has_client_info()) {

  bounds <- c(5.261, 52.680, 5.319, 52.715)
  
  ## prepare input data
  input <-
    dse_sh_prepare_input(
      bounds = bounds,
      time_range = c("2025-06-01 UTC", "2025-07-01 UTC")
    )

  ## prepare ouput format
  output <- dse_sh_prepare_output(bbox = bounds)
  
  ## retrieve processing script
  evalscript <- dse_sh_get_custom_script("/sentinel-2/l2a_optimized/")
  
  fl <- tempfile(fileext = ".tiff")
  ## send request and download result:
  dse_sh_process(input, output, evalscript, fl)

  if (requireNamespace("stars")) {
    library(stars)
    enkhuizen <- read_stars(fl) |> suppressWarnings()
    plot(enkhuizen, rgb = 1:3, axes = TRUE, main = "Enkhuizen")
  }
}
}
\references{
\itemize{
\item \url{https://docs.sentinel-hub.com/api/latest/api/process/}
\item \url{https://shapps.dataspace.copernicus.eu/requests-builder/}
\item \url{https://custom-scripts.sentinel-hub.com/}
\item \url{https://github.com/sentinel-hub/custom-scripts}
\item \url{https://docs.sentinel-hub.com/api/latest/evalscript/}
}
}
\seealso{
Other sentinelhub:
\code{\link[=dse_sh_collections]{dse_sh_collections()}},
\code{\link[=dse_sh_custom_scripts]{dse_sh_custom_scripts()}},
\code{\link[=dse_sh_features]{dse_sh_features()}},
\code{\link[=dse_sh_get_custom_script]{dse_sh_get_custom_script()}},
\code{\link[=dse_sh_prepare_input]{dse_sh_prepare_input()}},
\code{\link[=dse_sh_queryables]{dse_sh_queryables()}},
\code{\link[=dse_sh_search_request]{dse_sh_search_request()}},
\code{\link[=dse_sh_use_requests_builder]{dse_sh_use_requests_builder()}}
}
\concept{sentinelhub}
