Skip to content

Add min/maxzoom to the /tiles/{tileMatrixSetId} endpoint #1393

@vincentsarago

Description

@vincentsarago

@self.router.get(
"/tiles/{tileMatrixSetId}",
response_model=TileSet,
response_class=JSONResponse,
response_model_exclude_none=True,
responses={
200: {
"content": {
"application/json": {},
"text/html": {},
}
}
},
summary="Retrieve the raster tileset metadata for the specified dataset and tiling scheme (tile matrix set).",
operation_id=f"{self.operation_prefix}getTileSet",
)
async def tileset(
request: Request,
tileMatrixSetId: Annotated[
Literal[tuple(self.supported_tms.list())],
Path(
description="Identifier selecting one of the TileMatrixSetId supported."
),
],
src_path=Depends(self.path_dependency),
reader_params=Depends(self.reader_dependency),
env=Depends(self.environment_dependency),
f: Annotated[
Literal["html", "json"] | None,
Query(
description="Response MediaType. Defaults to endpoint's default or value defined in `accept` header."
),
] = None,
):
"""Retrieve the raster tileset metadata for the specified dataset and tiling scheme (tile matrix set)."""
tms = self.supported_tms.get(tileMatrixSetId)
with rasterio.Env(**env):
with self.reader(
src_path, tms=tms, **reader_params.as_dict()
) as src_dst:
bounds = src_dst.get_geographic_bounds(tms.rasterio_geographic_crs)
minzoom = src_dst.minzoom
maxzoom = src_dst.maxzoom
collection_bbox = {
"lowerLeft": [bounds[0], bounds[1]],
"upperRight": [bounds[2], bounds[3]],
"crs": CRS_to_uri(tms.rasterio_geographic_crs),
}
tilematrix_limits = tms_limits(
tms,
bounds,
zooms=(minzoom, maxzoom),
)

kinda like #1391

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions