Skip to contents

These are helper functions to easy construction CQL2 expressions. These functions are not meant to be used in expressions and they must be escaped using {{ to be evaluated before request.

Usage

cql2_bbox_as_geojson(bbox)

cql2_date(x)

cql2_timestamp(x)

cql2_interval(start = "..", end = "..")

Arguments

bbox

a numeric containing a bbox with c(xmin, ymin, xmax, ymax).

x, start, end

a character string containing valid date or timestamp.

Value

  • cql2_bbox_as_geojson(): GeoJSON object.

  • cql2_date(), cql2_timestamp(), and cql2_interval(): internal rstac expressions representing temporal values.

Details

  • cql2_bbox_as_geojson(): used to convert bounding box (bbox) to a GeoJSON object to be used as argument of CQL2 spatial operators.

  • cql2_date(), cql2_timestamp(), and cql2_interval(): create temporal literal values to be passed into CQL2 expressions.

Examples

if (FALSE) { # \dontrun{
bbox <- c(-122.2751, 47.5469, -121.9613, 47.7458)

cql2_json(
    collection == "landsat-c2-l2" &&
      t_intersects(datetime, {{
        cql2_interval("2020-12-01", "2020-12-31")
      }}) &&
      s_intersects(geometry, {{
        cql2_bbox_as_geojson(bbox)
      }})
  )
} # }