Skip to content

Enable context extension for Search operations - search support for common STAC clients #207

@jaysnm

Description

@jaysnm

Many thanks to maintainers of this cool project.
I'm not sure if this this a feature request or bug report, nonetheless, this is what I have noted on /search functionality

I have tried catalog search using both sat-search and pystac-client but none seems to have native/compatible support.

While sat-search expects /search to return statistics of features matching query with no payload of feature items when limit is set to 0, stac-fastapi responds with 404 Error: Not Found

curl -X 'POST' \
  'http://162.10.0.1:9092/search' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "collections": ["ls8_sr_c2_l2"],
    "bbox": [-180, -90, 180, 90],
    "datetime": "2021-01-01/2021-08-01",
    "limit": 0
}'

Response

{
  "detail": "No features found"
}

Without limit=0

{
  "type": "FeatureCollection",
  "links": [
    {
      "rel": "next",
      "type": "application/json",
      "method": "POST",
      "href": "http://162.10.0.1:9092/search",
      "body": {
        "collections": [
          "ls8_sr_c2_l2"
        ],
        "bbox": [
          -180,
          -90,
          180,
          90
        ],
        "datetime": "2021-01-01/2021-08-01",
        "token": "next:c51cb097-e074-5768-bdcc-f1eeb1b6bd31"
      }
    },
    {
      "rel": "root",
      "type": "application/json",
      "href": "http://162.10.0.1:9092/"
    },
    {
      "rel": "self",
      "type": "application/json",
      "href": "http://162.10.0.1:9092/search"
    }
  ],
  "features": [
    {
      "id": "d0261e13-6fed-5c75-9dc4-5878aceae1cc",
  .....
}]

Executing a similar request on https://earth-search.aws.element84.com/v0/search with limit=0 on sentinel-s2-l1c collection yields

{'type': 'FeatureCollection',
 'stac_version': '1.0.0-beta.2',
 'stac_extensions': [],
 'context': {'page': 1, 'limit': 0, 'matched': 1731850, 'returned': 0},
 'numberMatched': 1731850,
 'numberReturned': 0,
 'features': [],
 'links': [{'rel': 'next',
   'title': 'Next page of results',
   'method': 'POST',
   'href': 'https://earth-search.aws.element84.com/v0/search',
   'merge': False,
   'body': {'datetime': '2021-01-01/2021-08-01',
    'intersects': {'type': 'Polygon',
     'coordinates': [[[-180, -90],
       [180, -90],
       [180, 90],
       [-180, 90],
       [-180, -90]]]},
    'collections': ['sentinel-s2-l1c'],
    'page': 2,
    'limit': 0}}]}

In addition to this disparity, result payload from stac-fastapi is missing context and/or numberMatched key. This makes sat-search return 0 count for items matching search terms. Please see this fork for my temp fix on sat-search side.

The incompatibility is not a sat-search problem because pystac-client is failing on search with NotImplementedError

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions