Description
pygeopapi expects links and assets to be top-level items, as specified in the STAC spec.
However, in pgSTAC, the collections and items schemas do not include them as top-level items, but store them in the contents JSONB column:
https://github.com/stac-utils/pgstac/blob/08ce5991e7840f51993d508c715fad44f889e5e5/src/pgstac/pgstac.sql#L889-L899
https://github.com/stac-utils/pgstac/blob/08ce5991e7840f51993d508c715fad44f889e5e5/src/pgstac/pgstac.sql#L2067-L2077
To access them when using a pgSTAC back-end, we should fetch from feature.properties.contents.links and feature.properties.contents.assets here:
|
for la in ['links', 'assets']: |
|
if feature.get(la) is None: |
|
feature[la] = [] |
Steps to Reproduce
Steps to reproduce the behavior:
- Setup pystac_client against a pygeoapi instance backed by pgSTAC
- Run
search.item_collection()
- Observe the links and assets are incomplete and missing from the output:
Expected behavior
The links and assets are sourced correctly from the pgSTAC backend:
Environment
- OS: Linux via Docker running on macOS
- Python version: 12
- pygeoapi version: 0.23.4
Description
pygeopapi expects links and assets to be top-level items, as specified in the STAC spec.
However, in pgSTAC, the collections and items schemas do not include them as top-level items, but store them in the
contentsJSONB column:https://github.com/stac-utils/pgstac/blob/08ce5991e7840f51993d508c715fad44f889e5e5/src/pgstac/pgstac.sql#L889-L899
https://github.com/stac-utils/pgstac/blob/08ce5991e7840f51993d508c715fad44f889e5e5/src/pgstac/pgstac.sql#L2067-L2077
To access them when using a pgSTAC back-end, we should fetch from
feature.properties.contents.linksandfeature.properties.contents.assetshere:pygeoapi/pygeoapi/api/stac.py
Lines 382 to 384 in 0c756e1
Steps to Reproduce
Steps to reproduce the behavior:
search.item_collection()Expected behavior
The links and assets are sourced correctly from the pgSTAC backend:
Environment