From dd935d786409a2c18a68a992892c31d9530c593c Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Mon, 10 Jun 2024 17:16:01 +0200 Subject: [PATCH] add `/layers` prefix for OGC GetTile --- docs/src/endpoints/ogc_wmts_endpoints.md | 10 +++++----- titiler/stacapi/factory.py | 4 ++-- titiler/stacapi/models.py | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/docs/src/endpoints/ogc_wmts_endpoints.md b/docs/src/endpoints/ogc_wmts_endpoints.md index d7c0c08..cc6a2ee 100644 --- a/docs/src/endpoints/ogc_wmts_endpoints.md +++ b/docs/src/endpoints/ogc_wmts_endpoints.md @@ -2,10 +2,10 @@ ### OGC WMTS endpoints -| Method | URL | Output | Description -| ------ | ------------------------------------------------------------------------------------|------------------------------|-------------- -| `GET` | `/wmts` | XML or image/bin or GeoJSON | OGC Web map tile service (KVP encoding) -| `GET` | `/{LAYER}/{STYLE}/{TIME}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.{FORMAT}` | image/bin | return a web map tile image +| Method | URL | Output | Description +| ------ | -------------------------------------------------------------------------------------------|------------------------------|-------------- +| `GET` | `/wmts` | XML or image/bin or GeoJSON | OGC Web map tile service (KVP encoding) +| `GET` | `/layers/{LAYER}/{STYLE}/{TIME}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.{FORMAT}` | image/bin | OGC GetTile (REST encoding) ### WMTS (GetCapabilities / GetTile / GetFeatureInfo) - KVP Encoding @@ -45,7 +45,7 @@ Example: ### GetTile - REST -`:endpoint:/{LAYER}/{STYLE}/{TIME}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.{FORMAT}` +`:endpoint:/layers/{LAYER}/{STYLE}/{TIME}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.{FORMAT}` - PathParams: - **Layer** (str): Layer identifier diff --git a/titiler/stacapi/factory.py b/titiler/stacapi/factory.py index 3c9d92b..b4823f3 100644 --- a/titiler/stacapi/factory.py +++ b/titiler/stacapi/factory.py @@ -1236,7 +1236,7 @@ def web_map_tile_service( # noqa: C901 ) @self.router.get( - "/{LAYER}/{STYLE}/{TIME}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.{FORMAT}", + "/layers/{LAYER}/{STYLE}/{TIME}/{TileMatrixSet}/{TileMatrix}/{TileCol}/{TileRow}.{FORMAT}", **img_endpoint_params, ) def WMTS_getTile( @@ -1311,7 +1311,7 @@ def WMTS_getTile( reader_params=Depends(self.reader_dependency), env=Depends(self.environment_dependency), ): - """Create map tile.""" + """OGC WMTS GetTile (REST encoding)""" search_query = {"collections": [collectionId], "datetime": timeId} tms = self.supported_tms.get(tileMatrixSetId) diff --git a/titiler/stacapi/models.py b/titiler/stacapi/models.py index bc5d82f..c50696a 100644 --- a/titiler/stacapi/models.py +++ b/titiler/stacapi/models.py @@ -27,7 +27,7 @@ class Link(BaseModel): str, Field( description="Supplies the URI to a remote resource (or resource fragment).", - example="http://data.example.com/buildings/123", + json_schema_extra={"example": "http://data.example.com/buildings/123"}, ), ] rel: Annotated[ @@ -40,7 +40,9 @@ class Link(BaseModel): Optional[MediaType], Field( description="A hint indicating what the media type of the result of dereferencing the link should be.", - example="application/geo+json", + json_schema_extra={ + "example": "application/geo+json", + }, ), ] = None templated: Annotated[ @@ -51,21 +53,27 @@ class Link(BaseModel): Optional[str], Field( description="A base path to retrieve semantic information about the variables used in URL template.", - example="/ogcapi/vars/", + json_schema_extra={ + "example": "/ogcapi/vars/", + }, ), ] = None hreflang: Annotated[ Optional[str], Field( description="A hint indicating what the language of the result of dereferencing the link should be.", - example="en", + json_schema_extra={ + "example": "en", + }, ), ] = None title: Annotated[ Optional[str], Field( description="Used to label the destination of a link such that it can be used as a human-readable identifier.", - example="Trierer Strasse 70, 53115 Bonn", + json_schema_extra={ + "example": "Trierer Strasse 70, 53115 Bonn", + }, ), ] = None length: Optional[int] = None