sat-utils/sat-api

Links dropped from STAC Item

Opened this issue · 3 comments

Sat-api currently drops all links (stac_item.links) when ingesting stac items. The bug is happening here.

const links = data.links.filter((link) => hlinks.includes(link))

The fix is filtering by rel:

const links = data.links.filter((link) => links.includes(link.rel))

@geospatial-jeff This behavior is by design. When we ingest an item we strip its referential links out so they can later be reconstructed dynamically when it is served through the API. This way it is served with links which reference the APIs deployed url. The link reconstruction happens here when an item is served. Some of the rationale for this approach is described in this discussion.

Hey @geospatial-jeff , as @sharkinsspatial said, the behavior of removing links is by design....but in re-reading your issue it looks like there is a bug and it is in fact removing all links because it's filtering by href which is an object and it's checking it against the list of string values: 'self', 'root', 'parent', 'child', 'collection', 'item', rather than link.rel.

Thanks for pointing it out, easy enough fix, I'll get it in the 0.3 branch

@geospatial-jeff It looks like we may have several issues like this on ingestion side. Thanks for flagging.