stac_download: Download STAC Assets

View source: R/stac_download.R

stac_downloadR Documentation

Download STAC Assets

Description

Downloads assets from STAC items returned by stac_search() or stac_items(). Wraps rstac::assets_download() with tidy output.

Usage

stac_download(items, assets = NULL, output_dir = tempdir(), overwrite = FALSE)

Arguments

items

An rstac doc_items object as returned by stac_search() or stac_items() with the raw attribute, or the raw rstac result directly.

assets

Character vector. Asset names to download (e.g., c("red", "green", "blue")). If NULL, downloads all assets.

output_dir

Character. Directory where files are saved. Defaults to tempdir().

overwrite

Logical. Overwrite existing files? Defaults to FALSE.

Value

The rstac items object (invisibly) with assets downloaded to output_dir. Downloaded file paths can be retrieved with rstac::assets_url().

Examples



# Search for items first
items <- stac_search(
  url = "https://earth-search.aws.element84.com/v1",
  collections = "sentinel-2-l2a",
  bbox = c(-84.5, 38.0, -84.3, 38.2),
  limit = 1
)



stacr documentation built on March 12, 2026, 5:07 p.m.