-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyStac and swisstopo API #1
Comments
I'm still in the process of learning about the STAC API, but here is my take on this issue. It seems to me that the swisstopo STAC API (link) doesn't quite follow the usual practice of organising and linking the STAC objects (or at least in a way that Starting with the "landing page" - https://data.geo.admin.ch/api/stac/v0.9/ - you get a JSON object that more or less corresponds to the STAC Catalog and can be read with from pystac import Catalog
cat = Catalog.from_file('https://data.geo.admin.ch/api/stac/v0.9/') However, the relation-types of the linked objects don't specify any child objects: cat.to_dict()
Hence, it is not amenable to discovery via the list(cat.get_children())
Looking at the link objects of the next(cat.get_stac_objects(rel="data")) # KeyError: 'id' You can read-in individual collections (supplying the correct URLs): from pystac import STAC_IO
col = STAC_IO.read_stac_object("https://data.geo.admin.ch/api/stac/v0.9/collections/ch.swisstopo.landeskarte-farbe-10")
print(type(col)) # pystac.collection.Collection However, the same issues related to the linking / naming the relation-types persist - so none of I don't know if this an issue of STAC spec version being 0.9.0 (I can't imagine the spec would be that much different) or if really the problem is implementation (swisstopo) versus expectation ( Maybe @martinchristen knows somebody at swisstopo who could elaborate on this? |
Thanks @MatusGasparik this is what I noticed too. Another "issue" is that you can't convert the output directly to a Python dictionary. While I really don't recommend using eval to convert JSON to a Python dict, this seems to work for other STAC servers... |
Please consider that pystac strongly relies on the presence of "child" links: it is thus mainly for "static catalogs". |
I also tried https://github.com/brazil-data-cube/stac.py and another one I don't remember at the moment and they all didn't work. We could do some bug reports/issues there. |
IMHO all these STAC tools do not yet support reading collections information from the /collections endpoint (rel='data') |
Both https://github.com/stac-utils/pystac-client and https://github.com/brazil-data-cube/stac.py will soon support reading collections from the /collection endpoint (rel='data'). See: |
That is great news, thanks. I will create some examples in this repo here. |
@martinchristen in the notebook you say that PyStac doesn't work with the swisstopo STAC API.
Could you please tell more on this?
The text was updated successfully, but these errors were encountered: