if (FALSE) {
x <- stac("https://brazildatacube.dpi.inpe.br/stac") %>%
stac_search(collections = "CB4-16D-2") %>%
stac_search(datetime = "2020-01-01/2021-01-01", limit = 500) %>%
get_request()
x %>% items_length()
x %>% items_matched()
x %>% items_datetime()
x %>% items_bbox()
x %>% items_fetch()
}
if (FALSE) {
# Defining BDC token
Sys.setenv("BDC_ACCESS_KEY" = "token-123")
# doc_item object
stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
stac_search(collections = "CB4-16D-2", limit = 100,
datetime = "2017-08-01/2018-03-01",
bbox = c(-48.206, -14.195, -45.067, -12.272)) %>%
get_request() %>% items_sign(sign_fn = sign_bdc())
}
if (FALSE) {
# doc_items object
stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
stac_search(collections = "CB4-16D-2", limit = 100,
datetime = "2017-08-01/2018-03-01",
bbox = c(-48.206, -14.195, -45.067, -12.272)) %>%
get_request() %>%
items_filter(properties$`eo:cloud_cover` < 10)
# Example with AWS STAC
stac("https://earth-search.aws.element84.com/v0") %>%
stac_search(collections = "sentinel-s2-l2a-cogs",
bbox = c(-48.206, -14.195, -45.067, -12.272),
datetime = "2018-06-01/2018-06-30",
limit = 500) %>%
post_request() %>%
items_filter(filter_fn = function(x) {x$properties$`eo:cloud_cover` < 10})
}
if (FALSE) {
# doc_items object
stac_item <- stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
stac_search(collections = "CB4-16D-2", limit = 100,
datetime = "2017-08-01/2018-03-01",
bbox = c(-48.206, -14.195, -45.067, -12.272)) %>%
get_request() %>%
items_fetch(progress = FALSE)
stac_item %>% items_reap(c("properties", "datetime"))
# Extract all asset URLs from each item
stac_item %>% items_reap(c("assets", "*"), \(x) x$href)
stac_item %>% items_as_sf()
stac_item %>% items_as_tibble()
stac_item %>% items_select(c(1, 4, 10, 20))
}
Run the code above in your browser using DataLab