|
8 | 8 | from geojson_pydantic.features import Feature, FeatureCollection |
9 | 9 | from geojson_pydantic.geometries import Polygon |
10 | 10 | from morecantile import TileMatrixSet |
11 | | -from morecantile import tms as default_tms |
| 11 | +from morecantile import tms as morecantile_tms |
12 | 12 | from morecantile.defaults import TileMatrixSets |
13 | 13 | from rio_tiler.io import BaseReader, MultiBandReader, MultiBaseReader, Reader |
14 | 14 | from rio_tiler.models import BandStatistics, Bounds, Info |
@@ -143,7 +143,8 @@ class BaseTilerFactory(metaclass=abc.ABCMeta): |
143 | 143 | environment_dependency: Callable[..., Dict] = lambda: dict() |
144 | 144 |
|
145 | 145 | # TileMatrixSet dependency |
146 | | - supported_tms: TileMatrixSets = default_tms |
| 146 | + supported_tms: TileMatrixSets = morecantile_tms |
| 147 | + default_tms: str = "WebMercatorQuad" |
147 | 148 |
|
148 | 149 | # Router Prefix is needed to find the path for /tile if the TilerFactory.router is mounted |
149 | 150 | # with other router (multiple `.../tile` routes). |
@@ -465,8 +466,8 @@ def tile( |
465 | 466 | x: int = Path(..., description="TMS tiles's column"), |
466 | 467 | y: int = Path(..., description="TMS tiles's row"), |
467 | 468 | TileMatrixSetId: Literal[tuple(self.supported_tms.list())] = Query( |
468 | | - "WebMercatorQuad", |
469 | | - description="TileMatrixSet Name (default: 'WebMercatorQuad')", |
| 469 | + self.default_tms, |
| 470 | + description=f"TileMatrixSet Name (default: '{self.default_tms}')", |
470 | 471 | ), |
471 | 472 | scale: int = Query( |
472 | 473 | 1, gt=0, lt=4, description="Tile size scale. 1=256x256, 2=512x512..." |
@@ -549,8 +550,8 @@ def tilejson(self): # noqa: C901 |
549 | 550 | def tilejson( |
550 | 551 | request: Request, |
551 | 552 | TileMatrixSetId: Literal[tuple(self.supported_tms.list())] = Query( |
552 | | - "WebMercatorQuad", |
553 | | - description="TileMatrixSet Name (default: 'WebMercatorQuad')", |
| 553 | + self.default_tms, |
| 554 | + description=f"TileMatrixSet Name (default: '{self.default_tms}')", |
554 | 555 | ), |
555 | 556 | src_path=Depends(self.path_dependency), |
556 | 557 | tile_format: Optional[ImageType] = Query( |
@@ -694,8 +695,8 @@ def wmts(self): # noqa: C901 |
694 | 695 | def wmts( |
695 | 696 | request: Request, |
696 | 697 | TileMatrixSetId: Literal[tuple(self.supported_tms.list())] = Query( |
697 | | - "WebMercatorQuad", |
698 | | - description="TileMatrixSet Name (default: 'WebMercatorQuad')", |
| 698 | + self.default_tms, |
| 699 | + description=f"TileMatrixSet Name (default: '{self.default_tms}')", |
699 | 700 | ), |
700 | 701 | src_path=Depends(self.path_dependency), |
701 | 702 | tile_format: ImageType = Query( |
@@ -1457,7 +1458,7 @@ def geojson_statistics( |
1457 | 1458 | class TMSFactory: |
1458 | 1459 | """TileMatrixSet endpoints Factory.""" |
1459 | 1460 |
|
1460 | | - supported_tms: TileMatrixSets = default_tms |
| 1461 | + supported_tms: TileMatrixSets = morecantile_tms |
1461 | 1462 |
|
1462 | 1463 | # FastAPI router |
1463 | 1464 | router: APIRouter = field(default_factory=APIRouter) |
|
0 commit comments