Learn R Programming

rstac (version 0.9.1-5)

items_functions: STACItemCollection functions

Description

These functions provide support to work with STACItemCollection and STACItem objects.

  • items_length(): shows how many items there are in the STACItemCollection object.

  • items_matched(): shows how many items matched the search criteria. It supports search:metadata (v0.8.0), context (v0.9.0), and numberMatched (OGC WFS3 core spec).

  • items_fetch(): request all STAC Items through pagination.

  • items_next(): fetches a new page from STAC service.

  • items_datetime(): retrieves a the datetime field in properties from STACItemCollection and STACItem objects.

  • items_bbox(): retrieves a the bbox field of a STACItemCollection or an STACItem object.

  • item_assets(): returns the assets name from STACItemCollection and STACItem objects.

  • items_filter(): selects only items that match some criteria.

  • items_reap(): extract key values by traversing all items in an STACItemCollection object.

  • items_fields(): lists field names inside an item.

  • items_group(): organizes items as elements of a list using some criteria.

  • items_sign(): allow access assets by preparing its url.

This function returns the subfields of the feature field of a STACItemCollection object.

Usage

items_length(items)

# S3 method for STACItem items_length(items)

# S3 method for STACItemCollection items_length(items)

items_matched(items, ...)

# S3 method for STACItem items_matched(items, ...)

# S3 method for STACItemCollection items_matched(items, ..., matched_field = NULL)

items_fetch(items, ...)

# S3 method for STACItem items_fetch(items, ...)

# S3 method for STACItemCollection items_fetch(items, ..., progress = TRUE, matched_field = NULL)

items_next(items, ...)

# S3 method for STACItem items_next(items, ...)

# S3 method for STACItemCollection items_next(items, ...)

items_datetime(items)

# S3 method for STACItem items_datetime(items)

# S3 method for STACItemCollection items_datetime(items)

items_bbox(items)

# S3 method for STACItem items_bbox(items)

# S3 method for STACItemCollection items_bbox(items)

items_assets(items, ...)

# S3 method for STACItem items_assets(items, ...)

# S3 method for STACItemCollection items_assets(items, ..., simplify = FALSE)

items_filter(items, ..., filter_fn = NULL)

items_reap(items, ..., field = NULL)

items_fields(items, ..., field = NULL)

# S3 method for STACItemCollection items_fields(items, ..., field = NULL)

# S3 method for STACItem items_fields(items, ..., field = NULL)

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

items_sign(items, ..., sign_fn = NULL)

# S3 method for STACItemCollection items_sign(items, ..., sign_fn = NULL)

# S3 method for STACItem items_sign(items, ..., sign_fn = NULL)

Value

  • items_length(): an integer value.

  • items_matched(): returns an integer value if STAC web server does support this extension, otherwise returns NULL.

  • items_fetch(): an STACItemCollection with all matched items.

  • items_next(): fetches a new page from STAC service.

  • items_datetime(): a list of all items' datetime.

  • items_bbox(): returns a list with all items' bounding boxes.

  • item_assets(): if simplify is TRUE, returns a character value with all assets names of the first item. Otherwise, returns a list with assets name for each item.

  • items_filter(): a STACItemCollection object.

  • items_reap(): a vector if the supplied field is atomic, otherwise or a list.

  • items_fields(): a character vector.

  • items_group(): a list of STACItemCollection objects.

  • items_sign(): a STACItemCollection object with signed assets url

A character with the subfields of the feature field.

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.

matched_field

a character vector with the path where the number of items returned in the named list is located starting from the initial node of the list. For example, if the information is at position items$meta$found of the object, it must be passed as the following parameter c("meta", "found").

progress

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

simplify

a logical should return only the assets name of the first item? if not a list with all assets name will be returned. Default is FALSE.

filter_fn

a function that receives an item that should evaluate a logical value.

field

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

index

an atomic vector with values as group index

sign_fn

a function that receives an item as parameter and returns an item signed.

Details

Ellipsis argument (...) appears in different items function and has distinct purposes:

  • items_matched() and items_assets(): ellipsis is not used.

  • items_fetch() and items_next(): ellipsis is used to pass additional httr options to GET or POST methods, such as add_headers or set_cookies.

  • items_filter(): ellipsis is used to pass logical expressions using keys in properties field as filter criteria.

  • items_reap(), items_fields(), and items_group(): ellipsis can be used to provide fields names to get the subfields values from the STACItemCollection objects.

  • items_sign(): in a near future, ellipsis will be used to append key value pairs to url query string of an asset.

items_sign() has sign_fn parameter that must be a function that receives as argument an item and returns an signed item. rstac provides sign_bdc() and sign_planetary_computer() functions to access Brazil Data Cube products and Microsoft Planetary Computer catalogs, respectively.