Open tpoisot opened 1 month ago
Thanks for the reproducer.
The code is looking for item
(without the endings s
):
In stac.geobon.org's JSON however, the rel
field has the value items
(with an s):
julia> entry = catalog["chelsa-clim"];
julia> entry.data.links
4-element JSON3.Array{JSON3.Object, Base.CodeUnits{UInt8, String}, SubArray{UInt64, 1, Vector{UInt64}, Tuple{UnitRange{Int64}}, true}}:
{
"rel": "items",
"type": "application/geo+json",
"href": "https://stac.geobon.org/collections/chelsa-clim/items"
}
{
"rel": "parent",
"type": "application/json",
"href": "https://stac.geobon.org/"
}
{
"rel": "root",
"type": "application/json",
"href": "https://stac.geobon.org/"
}
{
"rel": "self",
"type": "application/json",
"href": "https://stac.geobon.org/collections/chelsa-clim"
}
See the spec: https://github.com/radiantearth/stac-spec/blob/2e6947df194a707354d6d5be1da6762647ee593f/commons/links.md#link-object
and example:
Does the spec also mentions items
in plural for the rel
field?
Thanks @Alexander-Barth -- you are right, neither the spec nor the types for link relations in IANA use items
@jmlord / @glaroc -- it seems that the GEOBON STAC catalogue isn't following the spec
We are using STAC Fastapi. This might be a difference between STAC spec and STAC API spec ? Other catalogs I'm looking at use items with an "s".
https://planetarycomputer.microsoft.com/api/stac/v1/collections/terraclimate https://eocat.esa.int/eo-catalogue/collections
Yeah, the STAC API spec is different from the STAC spec 😕
That would be a real bummer. The STAC spec is already quite extensive as is. Or maybe it is an extension (https://stac-extensions.github.io/) or a beta version of the spec (just a speculation). Maybe the raising an issue at https://github.com/radiantearth/stac-spec/ would help?
In any case, if catalogs like the Planetary Computer and ESA have items instead of item, this library should probably support it. Otherwise, many users will face similar issues. The rstac R package and the Python pystac library work fine with our catalog.
Are you able to read the items with pystac? This is what I tried, but I got also an empty list for the items.
import pystac
root_catalog = pystac.Catalog.from_file("https://stac.geobon.org/")
root_catalog.get_child("chelsa-clim").title
# output 'CHELSA Climatologies'
list(root_catalog.get_child("chelsa-clim").get_items())
# output []
list(root_catalog.get_child("chelsa-clim").get_items(recursive=True))
# output []
pystac.__version__
# output '1.10.1'
I am not very familiar with pystac, I followed the documentation here https://pystac.readthedocs.io/en/stable/quickstart.html#Crawling-Items
@Alexander-Barth I believe you have to use pystac_client: https://pystac-client.readthedocs.io/en/latest/usage.html
Static and dynamic catalogs have different characteristics. For example, sub-catalogs are not allowed with the STAC API Spec, while they are in the STAC Spec. I guess items vs item is another difference.
The following is empty:
Specifically, the output is
But using the URL gives a list of the expected items withing this collection: https://stac.geobon.org/collections/chelsa-clim/items
Is there something I am missing?