Skip to contents

The ext_query() is the exported function of the STAC API query extension. It can be used after a call to stac_search() function. It allows that additional fields and operators other than those defined in stac_search() function be used to make a complex filter.

The function accepts multiple filter criteria. Each filter entry is an expression formed by <field> <operator> <value>, where <field> refers to a valid item property. Supported <fields> depends on STAC API service implementation. The users must rely on the service providers' documentation to know which properties can be used by this extension.

The ext_query() function allows the following <operators>

  • == corresponds to 'eq'

  • != corresponds to 'neq'

  • < corresponds to 'lt'

  • <= corresponds to 'lte'

  • > corresponds to 'gt'

  • >= corresponds to 'gte'

  • \%startsWith\% corresponds to 'startsWith' and implements a string prefix search operator.

  • \%endsWith\% corresponds to 'endsWith' and implements a string suffix search operator.

  • \%contains\%: corresponds to 'contains' and implements a string infix search operator.

  • \%in\%: corresponds to 'in' and implements a vector search operator.

Besides this function, the following S3 generic methods were implemented to get things done for this extension:

See source file ext_query.R for an example of how to implement new extensions.

Usage

ext_query(q, ...)

Arguments

q

a rstac_query object expressing a STAC query criteria.

...

entries with format <field> <operator> <value>.

Value

A rstac_query object with the subclass ext_query containing all request parameters to be passed to post_request() function.

Examples

if (FALSE) { # \dontrun{
 stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
   stac_search(collections = "CB4-16D-2") %>%
   ext_query("bdc:tile" %in% "007004") %>%
   post_request()
} # }