assets_download: Downloads assets via STAC API

Description Usage Arguments Value See Also Examples

View source: R/assets_download.R

Description

The assets_download function downloads the assets provided by the STAC API.

Usage

1
2
3
4
5
6
7
8
9
assets_download(
  items,
  assets_name,
  output_dir = ".",
  overwrite = FALSE,
  items_max = Inf,
  progress = TRUE,
  ...
)

Arguments

items

a STACItem or STACItemCollection object representing the result of /stac/search, /collections/{collectionId}/items or /collections/{collectionId}/items/{itemId} endpoints.

assets_name

a character with the assets names to be filtered.

output_dir

a character directory in which the assets will be saved.

overwrite

a logical if TRUE will replaced the existing file, if FALSE a warning message is shown. (FALSE, default).

items_max

a numeric corresponding how many items will be downloaded.

progress

a logical indicating if a progress bar must be shown or not. (TRUE, default).

...

config parameters to be passed to GET or POST methods, such as add_headers or set_cookies.

Value

The same STACItemCollection or STACItem object, with the link pointing to the directory where the assets were saved.

See Also

stac_search, items, get_request

Examples

1
2
3
4
5
6
7
8
## Not run: 
stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
  stac_search(collections = "CB4_64_16D_STK-1") %>%
  stac_search(limit = 2) %>%
  get_request() %>%
  assets_download(assets_name = "thumbnail", output_dir = ".")

## End(Not run)

rstac documentation built on July 10, 2021, 5:08 p.m.