Skip to content

Commit 8e08794

Browse files
committed
modify text based on comments from Rob
1 parent b9b7c83 commit 8e08794

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

fragments/filter/README.md

+21-13
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ those provided by SQL. The Simple CQL conformance class requires the logical ope
9696
the comparison operators `=`, `<`, `<=`, `>`, `>=`, `LIKE`, `IS NULL`, `BETWEEN`, and `IN`; the spatial operator
9797
`INTERSECTS`; and the temporal operator `ANYINTERACTS`.
9898

99-
The ANYINTERACTS operator has effectively the same semantics as the existing `datetime` filter.
99+
The ANYINTERACTS operator has effectively the same semantics as the `datetime` parameter
100+
in Item Search.
100101

101102
CQL enables these types of queries:
102103
- Use of Item Property values in predicates (e.g., `item.properties.eo:cloud_cover`), using comparison operators
@@ -194,6 +195,7 @@ These projects have or are developing CQL support:
194195

195196
- [GeoPython PyCQL](https://github.com/geopython/pycql/tree/master/pycql), and the
196197
[Bitner fork](https://github.com/bitner/pycql) to be used in stac-fastapi
198+
- [pygeofilter](https://github.com/geopython/pygeofilter) has support for ECQL (a superset of CQL Text) and CQL JSON
197199
- [Franklin](https://github.com/azavea/franklin) is working on it in [this PR](https://github.com/azavea/franklin/pull/750).
198200
- [Geotools](https://github.com/geotools/geotools) has support for [CQL text](https://github.com/geotools/geotools/tree/main/modules/library/cql/src/main/java/org/geotools/filter/text/cql2)
199201

@@ -215,7 +217,12 @@ fully-qualified property
215217
names not advertised in queryables (e.g., `properties.eo:cloud_cover`, in anticipation that there be some
216218
mechanism to explicitly allow or advertise this in the future.
217219

218-
Queryables are advertised via a JSON Schema document retrieved from the `/queryables` endpoint. A basic Queryables
220+
Queryables are advertised via a JSON Schema document retrieved from the `/queryables` endpoint. This endpoint at the root
221+
retrieves queryables that apply to all collections. When used as a subresource of the collection resource
222+
(e.g. /collections/collection1/queryables), it returns queryables pertaining only to that single collection.
223+
224+
It is required to implement both of these endpoints, but for a STAC API, this may simply be a static document of the
225+
STAC-specific fields. A basic Queryables
219226
definitions for STAC Items should include at least the fields id, collection, geometry, and datetime.
220227

221228
```json
@@ -404,7 +411,8 @@ Schema `$ref` mechanism to refer to a STAC schema definition. This not only allo
404411
but also binds an arbitrarily-named Queryable to a specific STAC field. For example, in the above we know that the
405412
`eo:cloud_cover` field is referring to the field of the same name in the EO Extension not because they happen to have the same
406413
name, but rather because the `$ref` indicates it. The field could just as well be named "cloud_cover", "CloudCover", or "cc",
407-
and we would still know it filtered on the EO extension `eo:cloud_cover` field.
414+
and we would still know it filtered on the EO extension `eo:cloud_cover` field. For example, if the queryable was named
415+
"CloudCover", a CQL expression using that queryable would look like `CloudCover <= 10`.
408416

409417
While these do seem quite complex to write and understand, keep in mind that query construction will likely be done with a
410418
more ergonomic SDK, and query parsing will be done with the help of a ABNF grammar and OpenAPI schema.
@@ -427,7 +435,7 @@ This example uses the queryables definition in (Interaction with Endpoints)(#int
427435
Note that `filter-lang` defaults to `cql-text` in this case. The parameter `filter-crs` defaults
428436
to `http://www.opengis.net/def/crs/OGC/1.3/CRS84` for a STAC API.
429437

430-
```http
438+
```javascript
431439
GET /search?filter=id='LC08_L1TP_060247_20180905_20180912_01_T1_L1TP' AND collection='landsat8_l1tp'
432440
```
433441
@@ -436,7 +444,7 @@ GET /search?filter=id='LC08_L1TP_060247_20180905_20180912_01_T1_L1TP' AND collec
436444
Note that `filter-lang` defaults to `cql-json` in this case. The parameter `filter-crs` defaults
437445
to `http://www.opengis.net/def/crs/OGC/1.3/CRS84` for a STAC API.
438446

439-
```http
447+
```javascript
440448
POST /search
441449
{
442450
"filter": {
@@ -463,7 +471,7 @@ OGC API Features filters only operate against a single collection already.
463471

464472
#### Example 2: GET with cql-text
465473

466-
```http
474+
```javascript
467475
GET /search?filter=collection = 'landsat8_l1tp'
468476
AND gsd <= 30
469477
AND eo:cloud_cover <= 10
@@ -473,7 +481,7 @@ GET /search?filter=collection = 'landsat8_l1tp'
473481

474482
#### Example 2: POST with cql-json
475483

476-
```http
484+
```javascript
477485
POST /search
478486
{
479487
"filter-lang": "cql-json",
@@ -547,13 +555,13 @@ This queryables JSON Schema is used in these examples:
547555

548556
#### Example 3: GET with cql-text
549557

550-
```http
558+
```javascript
551559
GET /search?filter=prop1 = prop2
552560
```
553561

554562
#### Example 3: POST with cql-json
555563

556-
```http
564+
```javascript
557565
POST /search
558566
{
559567
"filter-lang": "cql-json",
@@ -660,7 +668,7 @@ a tiny sliver of data.
660668
661669
#### Example 4: AND cql-text (GET)
662670
663-
```http
671+
```javascript
664672
/search?filter=sentinel:data_coverage > 50 AND eo:cloud_cover < 10
665673
```
666674
@@ -700,7 +708,7 @@ This uses the same queryables as Example 4.
700708

701709
#### Example 5: OR cql-text (GET)
702710

703-
```http
711+
```javascript
704712
/search?filter=sentinel:data_coverage > 50 OR eo:cloud_cover < 10
705713
```
706714

@@ -736,7 +744,7 @@ The only temporal operator required is `ANYINTERACTS`, which follows the same se
736744

737745
#### Example 6: ANYINTERACTS cql-text (GET)
738746

739-
```http
747+
```javascript
740748
/search?filter=datetime ANYINTERACTS 2020-11-11
741749
```
742750

@@ -761,7 +769,7 @@ GeoJSON geometries.
761769

762770
#### Example 6: INTERSECTS cql-text (GET)
763771

764-
```http
772+
```javascript
765773
/search?filter=INTERSECTS(geometry,POLYGON((-77.0824 38.7886,-77.0189 38.7886,-77.0189 38.8351,-77.0824 38.8351,-77.0824 38.7886)))
766774
```
767775

item-search/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ The full description and examples of this are found in the [context fragment](..
313313
- **Extension [Maturity Classification](../extensions.md#extension-maturity):** Deprecated
314314
- **Definition**: [STAC API - Query Fragment](../fragments/query/)
315315

316+
**Note** - the Query Extension is deprecated as of 1.0.0. Implementers
317+
are encouraged to use the Filter Extension instead.
318+
316319
The STAC search endpoint, `/search`, by default only accepts a limited set of parameters to limit the results
317320
by properties. The Query extension adds a new parameter, `query`, that can take a number of comparison operators to
318321
match predicates between the fields requested and the values of Item objects. It can be used with both GET and POST, though

0 commit comments

Comments
 (0)