Hi everyone,
I’m trying to create a STAC catalog to facilitate searching some COGs in S3.
The data in question are 30 m Copernicus DEM GeoTIFs. I’ve been following the tutorial here. Basically, I want to be able to query this collection of data and load just the area I want. The rub is that it’s just a collection of GeoTIFFs, not a STAC catalog. Okay, I’ll create one that references them, I thought…
I saved the catalog using
catalog.normalize_and_save(os.path.join('/home/guy/data/Agreed/Copernicus/DEM/', 'stac'), catalog_type=pystac.CatalogType.ABSOLUTE_PUBLISHED)
(I also tried RELATIVE_PUBLISHED - I must admit I’m not really sure on the meanings of these). This gave me a directory tree full of .json files with a ‘catalog.json’ in the ‘stac’ root. I load the catalog with
catalog = Client.open('/home/guy/data/Agreed/Copernicus/DEM/stac/catalog.json')
and it seems to work (does something). If I get the collections in this catalog:
for c in catalog.get_all_collections():
print(c)
I get:
<CollectionClient id=dem-30m>
which makes sense, because I put one collection in that catalog with that id.
Using code I’ve used before to run a query using an image bounds:
query = catalog.search(
collections=["dem-30m"],
limit=100,
bbox=bbox
)
I get:
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
Cell In [82], line 1
----> 1 query = catalog.search(
2 collections=["dem-30m"],
3 limit=100,
4 bbox=bbox
5 )
File ~/anaconda3/envs/geocube/lib/python3.10/site-packages/pystac_client/client.py:422, in Client.search(self, method, max_items, limit, ids, collections, bbox, intersects, datetime, query, filter, filter_lang, sortby, fields)
321 """Query the ``/search`` endpoint using the given parameters.
322
323 This method returns an :class:`~pystac_client.ItemSearch` instance. See that
(...)
419 a ``"rel"`` type of ``"search"``.
420 """
421 if not self._conforms_to(ConformanceClasses.ITEM_SEARCH):
--> 422 raise NotImplementedError(
423 "This catalog does not support search because it "
424 f'does not conform to "{ConformanceClasses.ITEM_SEARCH}"'
425 )
426 search_link = self.get_search_link()
427 if search_link:
NotImplementedError: This catalog does not support search because it does not conform to "ConformanceClasses.ITEM_SEARCH"
(Note, I get the same error if I deliberately mistype the collection id, whereas I was expecting more of a lookup/key error.
Could anyone give me some pointers? I want to create a catalog.json that references these GeoTIFFs and allows me to query and then grab just the area of interest. In my local directory, I have a tree that refers to all the various files and the json in each does seem to contain metadata such as spatial extent etc, so in theory the information should be there that supports a spatial query…