stac-api-spec
stac-api-spec copied to clipboard
How would one query for items with a given asset?
I went a bit down the rabbit hole of trying to find items with tilesets from the Planetary Computer catalog and came up empty-handed:
https://observablehq.com/d/aebe7aae2645cdc9
For the question of "How do I ask a STAC endpoint for all items with TileJSON," which I suspect will be pretty similar to asking "how do I find all items with a geotiff, zarr, etc version," I'm not sure of the route. There's the search extension, but it's not documented or guessable how to use it to filter the assets object - it contains a few operators, none of which with specified behavior on arrays, and most of which are not implemented in the Planetary Computer.
Just scanning the search endpoint for the first 10 pages or 2,500 results gave no results with an assets.tilejson property, which seems unusual as well.
Thanks for any guidance here, and I know it's sort of in between STAC itself and the Planetary Computer implementation that spec, so I guess the STAC-side question is "how does one write this query" or alternatively I took a wrong turn a while ago and I should be doing this entirely differently!
How does one write this query.
Currently there is no way to filter the assets object, so you can't really answer this question through a STAC API besides client-side filtering which isn't too feasible. My understanding is the search endpoint is scoped to searching on item.properties, so that wouldn't work either.
There is the Item Assets Extension adding a field to each collection describing what assets are contained by its children, and that makes this more discoverable but not necessarily more searchable. The Collection Search extension allows searching over collections but it doesn't seem to support filtering assets either.
I'm guessing we'd need a new extension to support this, either at the collection or item level.
An item could have multiple assets that could be visualized, so I'm not sure adding TileJSON to items might not be something providers will want to add.
Just be aware that database may not have index for asset type so even if you search for specific asset type, such query might not be optimized.
cc @bitner
Moved discussion here:
- https://github.com/stac-api-extensions/best-practices/issues/3