% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/s3.R
\name{dse_s3_set_gdal_options}
\alias{dse_s3_set_gdal_options}
\title{Set-up S3 Configuration for GDAL Library}
\usage{
dse_s3_set_gdal_options(
  region = "us-east-1",
  ...,
  s3_key = dse_s3_get_key(),
  s3_secret = dse_s3_get_secret()
)
}
\arguments{
\item{region}{\href{https://aws.amazon.com/about-aws/global-infrastructure/regions_az/}{AWS Region}
used in instantiating the S3 client}

\item{...}{Ignored}

\item{s3_key, s3_secret}{The s3 key and secret registered under your Data Space
Ecosystem account}
}
\value{
Returns a \code{logical} value. \code{TRUE} if all variables
were successfully set. \code{FALSE} otherwise.
}
\description{
This function sets system environment variables, such
that the GDAL library can access the Copernicus Data Space
Ecosystem S3 storage. Note that these settings can be used
by any package depending on the GDAL library. Most notably:
\code{stars}, \code{terra}, and \code{gdalraster}.
}
\examples{
if (interactive() && dse_has_s3_secret() &&
    requireNamespace("stars")) {
  library(dplyr)

  ## Get a Virtual System Interface to a tiff file:
  vsi <-
    dse_stac_get_uri(
      "S1A_IW_GRDH_1SDV_20241125T055820_20241125T055845_056707_06F55C_12F9_COG",
      "vh", "sentinel-1-grd") |>
      dse_s3_uri_to_vsi()

  ## Make sure to set gdal options with required S3 settings
  dse_s3_set_gdal_options()
   
  ## You can now read the file directly from the online storage
  ## without having to download it completely:
  cog <- stars::read_stars(vsi)
   
  ## You can also easily plot a downsampled version
  plot(cog, downsample = 50)
}
}
\seealso{
Other s3:
\code{\link[=dse_has_s3_secret]{dse_has_s3_secret()}},
\code{\link[=dse_s3_download]{dse_s3_download()}},
\code{\link[=dse_s3_uri_to_vsi]{dse_s3_uri_to_vsi()}}
}
\concept{s3}
