Truthfully I don't love how stac-fastapi populates the links on the root. It seems to be done in the core logic, rather than extensions being able to add to the list of links on the home page (maybe through the register method). Without modifying stac-fastapi, one way of getting /catalogs added to the root list of links is:
@attr.s
class CatalogsCoreClient(CoreCrudClient):
"""Extends CoreCrudClient to add catalog links to the landing page."""
async def landing_page(self, **kwargs):
"""Add /catalogs link to the landing page when the catalogs extension is enabled."""
result = await super().landing_page(**kwargs)
if self.extension_is_enabled("CatalogsExtension"):
base_url = get_base_url(kwargs["request"])
result["links"].append(
{
"rel": "catalogs",
"type": "application/json",
"title": "Catalogs available for this API",
"href": urljoin(base_url, "catalogs"),
}
)
return result
Then use this as the client when initializing StacApi.
Truthfully I don't love how stac-fastapi populates the links on the root. It seems to be done in the core logic, rather than extensions being able to add to the list of links on the home page (maybe through the
registermethod). Without modifyingstac-fastapi, one way of getting/catalogsadded to the root list of links is:Then use this as the
clientwhen initializingStacApi.