Skip to content

Bug: Links and Assets not sourced correctly from pgSTAC #2355

@rajadain

Description

@rajadain

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:
Image

Expected behavior
The links and assets are sourced correctly from the pgSTAC backend:

Image

Environment

  • OS: Linux via Docker running on macOS
  • Python version: 12
  • pygeoapi version: 0.23.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions