stac_search: Endpoint functions

Description Usage Arguments Value See Also Examples

View source: R/stac_search.R

Description

(This document is based on STAC specification documentation https://github.com/radiantearth/stac-spec/ and reproduces some of its parts)

The stac_search function implements /stac/search API endpoint (v0.8.1) and /search (v0.9.0 or v1.0.0). It prepares query parameters used in search API request, a stac object with all filter parameters to be provided to get_request or post_request functions. The GeoJSON content returned by these requests is a STACItemCollection object, a regular R list representing a STAC Item Collection document.

Usage

1
2
3
4
5
6
7
8
9
stac_search(
  q,
  collections = NULL,
  ids = NULL,
  bbox = NULL,
  datetime = NULL,
  intersects = NULL,
  limit = NULL
)

Arguments

q

a RSTACQuery object expressing a STAC query criteria.

collections

a character vector of collection IDs to include in the search for items. Only items in one of the provided collections will be searched.

ids

a character vector with item IDs. All other filter parameters that further restrict the number of search results are ignored.

bbox

a numeric vector with only features that have a geometry that intersects the bounding box are selected. The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (elevation or depth):

  • Lower left corner, coordinate axis 1

  • Lower left corner, coordinate axis 2

  • Lower left corner, coordinate axis 3 (optional)

  • Upper right corner, coordinate axis 1

  • Upper right corner, coordinate axis 2

  • Upper right corner, coordinate axis 3 (optional)

The coordinate reference system of the values is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84). The values are in most cases the sequence of minimum longitude, minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans the antimeridian the first value (west-most box edge) is larger than the third value (east-most box edge).

datetime

a character with a date-time or an interval. Date and time strings needs to conform RFC 3339. Intervals are expressed by separating two date-time strings by '/' character. Open intervals are expressed by using '..' in place of date-time.

Examples:

  • A date-time: "2018-02-12T23:20:50Z"

  • A closed interval: "2018-02-12T00:00:00Z/2018-03-18T12:31:12Z"

  • Open intervals: "2018-02-12T00:00:00Z/.." or "../2018-03-18T12:31:12Z"

Only features that have a datetime property that intersects the interval or date-time informed in datetime are selected.

intersects

a character value expressing GeoJSON geometries objects as specified in RFC 7946. Only returns items that intersect with the provided polygon.

limit

an integer defining the maximum number of results to return. If not informed it defaults to the service implementation.

Value

A RSTACQuery object with the subclass search containing all search field parameters to be provided to STAC API web service.

See Also

stac(), ext_query(), get_request(), post_request()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# GET request
stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
 stac_search(collections = "CB4_64_16D_STK-1", limit = 10,
        datetime = "2017-08-01/2018-03-01") %>%
 get_request()

# POST request
stac("https://brazildatacube.dpi.inpe.br/stac/") %>%
 stac_search(collections = "CB4_64_16D_STK-1",
        bbox = c(-47.02148, -12.98314, -42.53906, -17.35063)) %>%
 post_request()

rstac documentation built on Nov. 1, 2021, 1:08 a.m.