From d96e78871c4df3cf8e7764c7edf77d74b69d4731 Mon Sep 17 00:00:00 2001 From: Jo Date: Tue, 27 Jun 2023 11:48:12 -0400 Subject: [PATCH] - Added TileMatrixSet definition (from OGC NA) to the tilesets response: (#1290) See: https://docs.ogc.org/is/20-057/20-057.html#toc34 --- pygeoapi/api.py | 3 +++ pygeoapi/models/provider/base.py | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/pygeoapi/api.py b/pygeoapi/api.py index 52a44a3..1de03d5 100644 --- a/pygeoapi/api.py +++ b/pygeoapi/api.py @@ -1147,6 +1147,7 @@ class API: if tile: # TODO: translate + LOGGER.debug('Adding tile links') collection['links'].append({ 'type': FORMAT_TYPES[F_JSON], @@ -2760,6 +2761,7 @@ class API: 'dataType': 'vector', 'links': [] } + tile_matrix['links'].append(matrix.tileMatrixSetDefinition) tile_matrix['links'].append({ 'type': FORMAT_TYPES[F_JSON], 'rel': request.get_linkrel(F_JSON), @@ -2772,6 +2774,7 @@ class API: 'title': f'{dataset} - {matrix.tileMatrixSet} - {F_HTML}', 'href': f'{self.get_collections_url()}/{dataset}/tiles/{matrix.tileMatrixSet}?f={F_HTML}' # noqa }) + tiles['tilesets'].append(tile_matrix) metadata_format = p.options['metadata_format'] diff --git a/pygeoapi/models/provider/base.py b/pygeoapi/models/provider/base.py index 8a99599..db2b687 100644 --- a/pygeoapi/models/provider/base.py +++ b/pygeoapi/models/provider/base.py @@ -71,18 +71,33 @@ class TileMatrixSetEnumType(BaseModel): tileMatrixSet: str tileMatrixSetURI: str crs: str + tileMatrixSetDefinition: dict class TileMatrixSetEnum(Enum): WORLDCRS84QUAD = TileMatrixSetEnumType( tileMatrixSet="WorldCRS84Quad", tileMatrixSetURI="http://schemas.opengis.net/tms/1.0/json/examples/WorldCRS84Quad.json", # noqa - crs="http://www.opengis.net/def/crs/OGC/1.3/CRS84" + crs="http://www.opengis.net/def/crs/OGC/1.3/CRS84", + tileMatrixSetDefinition= + { + 'type': 'application/json', + 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme', + 'title': 'WorldCRS84QuadTileMatrixSet definition (as JSON)', + 'href': 'https://raw.githubusercontent.com/opengeospatial/2D-Tile-Matrix-Set/master/registry/json/WorldCRS84Quad.json' # authoritative TMS definition + } ) WEBMERCATORQUAD = TileMatrixSetEnumType( tileMatrixSet="WebMercatorQuad", tileMatrixSetURI="http://schemas.opengis.net/tms/1.0/json/examples/WebMercatorQuad.json", # noqa - crs="http://www.opengis.net/def/crs/EPSG/0/3857" + crs="http://www.opengis.net/def/crs/EPSG/0/3857", + tileMatrixSetDefinition= + { + 'type': 'application/json', + 'rel': 'http://www.opengis.net/def/rel/ogc/1.0/tiling-scheme', + 'title': 'WebMercatorQuadTileMatrixSet definition (as JSON)', + 'href': 'https://raw.githubusercontent.com/opengeospatial/2D-Tile-Matrix-Set/master/registry/json/WebMercatorQuad.json' # authoritative TMS definition + } )