Skip to content

Commit d665143

Browse files
fix: add tileMatrixSetId to path params (#523)
1 parent 6797366 commit d665143

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

.github/workflows/tests/test_stac.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,11 @@ def test_stac_api(self):
141141

142142
def test_stac_to_raster(self):
143143
"""test link to raster api."""
144+
tile_matrix_set_id = "WebMercatorQuad"
145+
144146
# tilejson
145147
resp = httpx.get(
146-
f"{self.stac_endpoint}/{self.collections_route}/{self.seeded_collection}/items/{self.seeded_id}/tilejson.json",
148+
f"{self.stac_endpoint}/{self.collections_route}/{self.seeded_collection}/items/{self.seeded_id}/{tile_matrix_set_id}/tilejson.json",
147149
params={"assets": "cog"},
148150
)
149151
assert resp.status_code == 307

stac_api/runtime/src/extension.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ def register(self, app: FastAPI, titiler_endpoint: str) -> None:
3434

3535
@tracer.capture_method
3636
@router.get(
37-
"/collections/{collectionId}/items/{itemId}/tilejson.json",
37+
"/collections/{collectionId}/items/{itemId}/{tileMatrixSetId}/tilejson.json",
3838
)
3939
async def tilejson(
4040
request: Request,
4141
collectionId: str = Path(..., description="Collection ID"),
4242
itemId: str = Path(..., description="Item ID"),
43+
tileMatrixSetId: str = Path(
44+
..., description="TileMatrixSet name (e.g. WebMercatorQuad)."
45+
),
4346
tile_format: Optional[str] = Query(
4447
None, description="Output image type. Default is auto."
4548
),
@@ -91,7 +94,7 @@ async def tilejson(
9194
qs.append(("collection", collectionId))
9295

9396
return RedirectResponse(
94-
f"{titiler_endpoint}/stac/tilejson.json?{urlencode(qs)}"
97+
f"{titiler_endpoint}/stac/{tileMatrixSetId}/tilejson.json?{urlencode(qs)}"
9598
)
9699

97100
@tracer.capture_method

0 commit comments

Comments
 (0)