Skip to content

Links returned by search queries don't contain custom fields #247

Open
@pedro-cf

Description

@pedro-cf

Describe the bug
Links returned by search queries don't contain custom fields.

To Reproduce

  1. Run app docker-compose up
  2. Create test collection
curl --request POST \
  --url http://localhost:8080/collections \
  --header 'Authorization: Basic YWRtaW46YWRtaW4=' \
  --header 'Content-Type: application/json' \
  --data '{"id":"test-collection","stac_extensions":["https://stac-extensions.github.io/eo/v1.0.0/schema.json"],"type":"Collection","description":"Landat 8 imagery radiometrically calibrated and orthorectified using gound points and Digital Elevation Model (DEM) data to correct relief displacement.","stac_version":"1.0.0","summaries":{"platform":["landsat-8"],"instruments":["oli","tirs"],"gsd":[30]},"extent":{"spatial":{"bbox":[[-180,-90,180,90]]},"temporal":{"interval":[["2013-06-01",null]]}},"links":[{"href":"http://localhost:8081/collections/landsat-8-l1","rel":"self","type":"application/json"},{"href":"http://localhost:8081/","rel":"parent","type":"application/json"},{"href":"http://localhost:8081/collections/landsat-8-l1/items","rel":"item","type":"application/geo+json"},{"href":"http://localhost:8081/","rel":"root","type":"application/json"}],"title":"Landsat 8 L1","keywords":["landsat","earth observation","usgs"]}'
  1. Create item with custom links (example from https://github.com/stac-extensions/web-map-links):
curl --request POST \
  --url http://localhost:8080/collections/test-collection/items \
  --header 'Content-Type: application/json' \
  --data '{"stac_version":"1.0.0","collection":"test-collection","stac_extensions":["https://stac-extensions.github.io/web-map-links/v1.2.0/schema.json"],"type":"Feature","id":"item","bbox":[172.9,1.3,173,1.4],"geometry":{"type":"Polygon","coordinates":[[[172.9,1.3],[173,1.3],[173,1.4],[172.9,1.4],[172.9,1.3]]]},"properties":{"datetime":"2020-12-11T22:38:32Z"},"attribution":"© 2022 The Example Corp.","links":[{"href":"https://example.com/examples/item.json","rel":"self"},{"href":"https://maps.example.com/wmts","rel":"wmts","type":"image/png","title":"RGB composite visualized through a WMTS","wmts:layer":["streets","satellite"]},{"href":"https://maps.example.com/wms","rel":"wms","type":"image/png","title":"RGB composite visualized through a WMS","wms:layers":["rgb"],"wms:transparent":true},{"href":"https://maps.example.com/xyz/{z}/{x}/{y}.jpg","rel":"xyz","type":"image/jpeg","title":"RGB composite visualized through a XYZ"},{"href":"https://maps.example.com/item/tilejson.json","rel":"tilejson","title":"TileJSON","type":"application/json"},{"href":"https://storage.googleapis.com/open-cogs/planet-stac/cocabamba-peru/3d-geofox.ai/3DTiles/tileset.json","rel":"3d-tiles","title":"3D Tiles","type":"application/json"},{"href":"https://maps.example.com/item/example.pmtiles","rel":"pmtiles","title":"PMTiles","type":"application/vnd.pmtiles","pmtiles:layers":["streets"]}],"assets":{}}'
  1. Search for all items:
curl --request POST \
  --url http://localhost:8080/search \
  --header 'Content-Type: application/json' \
  --data '{}'
  1. Response will will include links as follows:
"links": [
{
	"href": "https://maps.example.com/wms",
	"rel": "wms",
	"type": "image/png",
	"title": "RGB composite visualized through a WMS"
}

Expected behavior
Web Map Links should include custom fields like:

{
      "href": "https://maps.example.com/wms",
      "rel": "wms",
      "type": "image/png",
      "title": "RGB composite visualized through a WMS",
      "wms:layers": [
        "rgb"
      ],
      "wms:transparent": true
}

Additional context

stac_pydantic.Item(**feat).json(**filter_kwargs, exclude_unset=True)

Issue seems to be the version of stac_pydantic==2.0.*, I believe this will be fixed if upgraded to stac_pydantic==3.0.0 with stac-fastapi.api==3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions