assets_download: Downloads assets via STAC API

Description Usage Arguments Value See Also Examples

View source: R/assets-funs.R

Description

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

Usage

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

Arguments

items

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

asset_names

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.

items_max

a numeric corresponding how many items will be downloaded.

progress

a logical indicating if a progress bar must be shown or not. Defaults to TRUE.

fn

a function to handle the list of assets for each item. Using this function you can change the hrefs for each asset, as well as use another request verb, such as POST.

...

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

assets_name

[Deprecated] use asset_names parameter instead.

Value

The same STACItemCollection or STACItem object, with the link of the item 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
 9
10
## Not run: 
stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
  stac_search(collections = "CB4_64_16D_STK-1",
              datetime = "2019-06-01/2019-08-01") %>%
  stac_search() %>%
  get_request() %>%
  assets_download(asset_names = "thumbnail", output_dir = ".",
  overwrite = FALSE)

## End(Not run)

rstac documentation built on Nov. 1, 2021, 1:08 a.m.