add /collections/{collection_id}/items/{item_id}/assets/{asset_id}
endpoints
#133
Replies: 3 comments
-
What would follow for me would be:
|
Beta Was this translation helpful? Give feedback.
-
🙏 thanks @drwelby
We tend to use We also have to keep in mind that:
|
Beta Was this translation helpful? Give feedback.
-
😅 just realizing that we can already do most of this from starlette.requests import Request
from titiler.pgstac.dependencies import get_stac_item
from titiler.core.factory import TilerFactory
from typing_extensions import Annotated
from fastapi import FastAPI
def ItemPathParams(
request: Request,
collection_id: Annotated[str, Path(description="STAC Collection Identifier")],
item_id: Annotated[str, Path(description="STAC Item Identifier")],
asset_id: Annotated[str, Path(description="STAC Asset Identifier")],
) -> str:
"""STAC Item dependency."""
item = get_stac_item(request.app.state.dbpool, collection_id, item_id)
asset_info = item.assets[asset]
return asset_info.get_absolute_href() or asset_info.href,
app = FastAPI()
asset = TilerFactory(
path_dependency=ItemPathParams,
router_prefix="/collections/{collection_id}/items/{item_id}/assets/{asset_id}",
)
app.include_router(
asset.router, tags=["STAC Asset"], prefix="/collections/{collection_id}/items/{item_id}/assets/{asset_id}"
) ☝️ will not allow mixing assets but for this you'll want to go the |
Beta Was this translation helpful? Give feedback.
-
Right now we use query parameter to pass the
asset
we want to visualizebut in theory we could do something like
/assets/{asset_id}
suffix for one asset but what if we want to combine more than one?I'm not sure about using
,
as assets delimiter. what are other options?This is tricky but we could keep the same structure and add an
expression=True
parameterwe could also do something like:
Beta Was this translation helpful? Give feedback.
All reactions