Skip to content

Search Statistics Across Assets in Multiple Collections Fails #202

@bransonf

Description

@bransonf

I have two collections: ["opera-loss", "nlcd"] that I want to mosaic assets from and run some statistics via Titiler.

I register a search via POST /searches/register

{
        "collections": ["opera-loss", "nlcd"],
        "filter": {
            "op": "OR",
            "args": [
                {
                    "op": "AND",
                    "args": [
                        {
                            "op": "eq",
                            "args": [{"property": "collection"}, "opera-loss"]
                        },
                        {"op": "eq", "args": [{"property": "datetime"}, "2024-11-11"]}
                    ]
                },
                {
                    "op": "AND",
                    "args": [
                        {"op": "eq", "args": [{"property": "collection"}, "nlcd"]},
                        {"op": "eq", "args": [{"property": "datetime"}, "2021-01-01"]}
                    ]
                }
            ]
        }
    }

And validate the assets are found via GET /searches/<SEARCHID>/-98.5795,39.8283/assets:

[
  {
    "id": "-230400_1843200__2024-11-11",
    "bbox": [
      -98.73314824304305,
      39.580039124827444,
      -97.8050728162776,
      40.28159660136621
    ],
    "assets": {
      "opera_loss": {
        "href": "s3://***/opera_weekly/-230400_1843200/2024-11-11/-230400_1843200__2024-11-11.tif",
        "type": "image/tiff; application=geotiff; profile=cloud-optimized",
        "roles": [
          "data"
        ],
        "title": "opera_loss",
        "proj:epsg": 5070,
        "description": "",
        "raster:bands": [
          {
            "nodata": 255,
            "sampling": "area",
            "data_type": "int8",
            "spatial_resolution": 30
          }
        ]
      }
    },
    "collection": "opera-loss"
  },
  {
    "id": "-230400_1843200__2021",
    "bbox": [
      -98.73314824304305,
      39.580039124827444,
      -97.8050728162776,
      40.28159660136621
    ],
    "assets": {
      "nlcd": {
        "href": "s3://***/cogs/-230400_1843200/2021/nlcd.tif",
        "type": "image/tiff; application=geotiff; profile=cloud-optimized",
        "roles": [
          "data",
          "labels",
          "labels-raster"
        ],
        "title": "NLCD Land Cover",
        "proj:epsg": 5070,
        "description": "",
        "raster:bands": [
          {
            "nodata": 0,
            "sampling": "area",
            "data_type": "uint8",
            "spatial_resolution": 30
          }
        ]
      },      
     "collection": "nlcd"
  }
]

But when attempting to run POST /searches/<SEARCHID>/statistics with params:

assets=[ "opera_loss", "nlcd" ]
asset_as_band=true
expression="opera_loss + nlcd"

I get the error:

{
  "detail": "Invalid band/asset name 'nlcd'"
}

Changing to expression=opera_loss I get:

{
  "detail": "Could not find any valid assets in 'opera_loss' expression. Assets are: ['nlcd']"
}

And expression=nlcd I get:

{
  "detail": "Could not find any valid assets in 'nlcd' expression. Assets are: ['opera_loss']"
}

Is this a misguided use of the /searches endpoint, or should this sort of query across different collection-assets be possible?

I can work around this by adding the appropriate assets from the nlcd collection to the opera-loss collection or creating a new collection with the assets from both and registering a single-collection search + statistics, but it's not as elegant as being able to do cross-collection mosaicing.

PgSTAC version 0.8.5
Titiler version 0.1.0

Thanks for any insights here!

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