From 69987349d65895a9dc6affb81bdc109bd532ae68 Mon Sep 17 00:00:00 2001 From: Jo Date: Mon, 9 Dec 2024 15:45:10 +0000 Subject: [PATCH] - added checks to test the data type of tiles (#1867) --- pygeoapi/api/tiles.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pygeoapi/api/tiles.py b/pygeoapi/api/tiles.py index 7ac91d1d0..32d25ae9e 100644 --- a/pygeoapi/api/tiles.py +++ b/pygeoapi/api/tiles.py @@ -141,12 +141,17 @@ def get_collection_tiles(api: API, request: APIRequest, tiling_schemes = p.get_tiling_schemes() + datatype = 'vector' + + if t['format']['mimetype'].startswith('image'): + datatype = 'map' + for matrix in tiling_schemes: tile_matrix = { 'title': dataset, 'tileMatrixSetURI': matrix.tileMatrixSetURI, 'crs': matrix.crs, - 'dataType': 'vector', + 'dataType': datatype, 'links': [] } tile_matrix['links'].append({ @@ -464,12 +469,17 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, title = l10n.translate(v['title'], locale) description = l10n.translate(v['description'], locale) + datatype = 'vector' + + if tile_extension['format']['mimetype'].startswith('image'): + datatype = 'map' + paths[tiles_path] = { 'get': { 'summary': f'Fetch a {title} tiles description', 'description': description, 'tags': [k], - 'operationId': f'describe{k.capitalize()}.collection.vector.getTileSetsList', # noqa + 'operationId': f'describe{k.capitalize()}.collection.{datatype}.getTileSetsList', # noqa 'parameters': [ {'$ref': '#/components/parameters/f'}, {'$ref': '#/components/parameters/lang'} @@ -490,7 +500,7 @@ def get_oas_30(cfg: dict, locale: str) -> tuple[list[dict[str, str]], dict[str, 'summary': f'Get a {title} tile', 'description': description, 'tags': [k], - 'operationId': f'get{k.capitalize()}.collection.vector.getTile', # noqa + 'operationId': f'get{k.capitalize()}.collection.{datatype}.getTile', # noqa 'parameters': [ {'$ref': f"{OPENAPI_YAML['oapit']}#/components/parameters/tileMatrixSetId"}, # noqa {'$ref': f"{OPENAPI_YAML['oapit']}#/components/parameters/tileMatrix"}, # noqa