items_group: Utility functions

Description Usage Arguments Value Examples

View source: R/utils.R

Description

This function groups the items contained within the STACItemCollection object according to some specified fields. Each index in the returned list contains items belonging to the same group.

Usage

1
items_group(items, ..., field = NULL, index = NULL)

Arguments

items

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

...

a named way to provide field names to get the subfields values from the RSTACDocument objects.

field

a character with the names of the field to get the subfields values from the RSTACDocument objects.

index

a character with the indexes to be grouped. It can be used with the function items_reap.

Value

A list in which each index corresponds to a group with its corresponding STACItemCollection objects.

Examples

1
2
3
4
5
6
7
8
# STACItemCollection object
stac_item <- stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
 stac_search(collections = "CB4_64_16D_STK-1", 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_group(., field = c("properties", "bdc:tiles"))

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