These functions provide support to work with static catalogs.
stac_read(): open a STAC document from an URL.read_items(): opens (statically) all items referred inlinkskey entry of a given collection document (doc_collection).links(): extracts and filters the links of any STAC document.link_open(): opens (statically) the document referenced by the link. This function can resolve any relative URL.
Usage
read_stac(url, ...)
read_items(collection, ..., limit = 100, page = 1, progress = TRUE)
read_collections(catalog, ..., limit = 100, page = 1, progress = TRUE)
links(x, ...)
link_open(link, base_url = NULL)Arguments
- url
a
charactervalue with the URL to a valid STAC document.- ...
additional arguments. See details.
- collection
a
doc_collectionobject to fetch allrel=="item"links.- limit
an
integerwith defining the page size of items to fetch.- page
an
integerwith the page number to fetch the items.- progress
a
logicalindicating if a progress bar must be shown or not. Defaults toTRUE.- catalog
a
doc_catalogobject to fetch allrel=="child"links.- x
any
rstacdocument with'links'key entry.- link
a
doc_linkobject, usually an element oflinkskey entry.- base_url
a
characterwith the base URL to resolve relative links. IfNULL(default)rstacwill try resolve relative links using internal metadata.
Value
links(): adoc_linksobject containing a list oflinkentries.link_open(): a recognizablerstacdocument.
Details
Ellipsis argument (...) may appears in different items functions and
has distinct purposes:
stac_read(): ellipsis is used to pass any additional parameters to read_json function.links(): ellipsis is used to pass logical expressions to be evaluated against adoc_linkitem as a filter criteria. See examples.
Examples
if (FALSE) { # \dontrun{
x <- stac("https://brazildatacube.dpi.inpe.br/stac") %>%
collections("CB4-16D-2") %>%
get_request()
link <- links(x, rel == "items")
link_open(link[[1]])
} # }
if (FALSE) { # \dontrun{
wv_url <- paste0(
"https://s3.eu-central-1.wasabisys.com",
"/stac/openlandmap/wv_mcd19a2v061.seasconv/collection.json"
)
wv <- read_stac(wv_url)
stac_type(wv) # Collection
# reads the second page of 5 links
wv_items <- read_items(wv, limit = 5, page = 2)
# lists all links of the collection document that are not items
links(wv, rel != "item")
# lists all links of the items document
links(wv_items)
} # }
