From 9dc9355ef041113fb19aa7effcec681def0318f8 Mon Sep 17 00:00:00 2001 From: doublebyte1 Date: Thu, 7 Dec 2023 15:14:22 +0000 Subject: [PATCH 1/3] - on MVTilejson model, set default value on optional fields, so that they are not required. --- pygeoapi/models/provider/mvt.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pygeoapi/models/provider/mvt.py b/pygeoapi/models/provider/mvt.py index 73f318e10..837dcbc5b 100644 --- a/pygeoapi/models/provider/mvt.py +++ b/pygeoapi/models/provider/mvt.py @@ -41,12 +41,12 @@ class VectorLayers(BaseModel): class MVTTilesJson(BaseModel): tilejson: str = "3.0.0" - name: Optional[str] - tiles: Optional[str] - minzoom: Optional[int] - maxzoom: Optional[int] - bounds: Optional[str] - center: Optional[str] - attribution: Optional[str] - description: Optional[str] - vector_layers: Optional[List[VectorLayers]] + name: Optional[str] = None + tiles: Optional[str] = None + minzoom: Optional[int] = None + maxzoom: Optional[int] = None + bounds: Optional[str] = None + center: Optional[str] = None + attribution: Optional[str] = None + description: Optional[str] = None + vector_layers: Optional[List[VectorLayers]] = None From 638af92db052d8dedb89198af6dacad3fcad5c01 Mon Sep 17 00:00:00 2001 From: doublebyte1 Date: Thu, 7 Dec 2023 15:16:12 +0000 Subject: [PATCH 2/3] - fixed formatting (flake8) --- pygeoapi/models/provider/mvt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygeoapi/models/provider/mvt.py b/pygeoapi/models/provider/mvt.py index 837dcbc5b..c3344150d 100644 --- a/pygeoapi/models/provider/mvt.py +++ b/pygeoapi/models/provider/mvt.py @@ -42,7 +42,7 @@ class VectorLayers(BaseModel): class MVTTilesJson(BaseModel): tilejson: str = "3.0.0" name: Optional[str] = None - tiles: Optional[str] = None + tiles: Optional[str] = None minzoom: Optional[int] = None maxzoom: Optional[int] = None bounds: Optional[str] = None From 9a263cf96efe612c13b17b0cc3dda8fb7d45a27b Mon Sep 17 00:00:00 2001 From: Francesco Bartoli Date: Fri, 8 Dec 2023 23:28:08 +0100 Subject: [PATCH 3/3] Update base.py --- pygeoapi/models/provider/base.py | 98 ++++++++++++++++---------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/pygeoapi/models/provider/base.py b/pygeoapi/models/provider/base.py index db2b68741..2da39030b 100644 --- a/pygeoapi/models/provider/base.py +++ b/pygeoapi/models/provider/base.py @@ -3,8 +3,10 @@ # ================================================================= # # Authors: Antonio Cerciello +# Francesco Bartoli # # Copyright (c) 2022 Antonio Cerciello +# Copyright (c) 2023 Francesco Bartoli # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated documentation @@ -113,103 +115,103 @@ class TileMatrixLimitsType(BaseModel): class TwoDBoundingBoxType(BaseModel): lowerLeft: List[float] upperRight: List[float] - crs: Optional[str] + crs: Optional[str] = None class LinkType(BaseModel): href: str - rel: Optional[str] - type_: Optional[str] - hreflang: Optional[str] - title: Optional[str] - length: Optional[int] + rel: Optional[str] = None + type_: Optional[str] = None + hreflang: Optional[str] = None + title: Optional[str] = None + length: Optional[int] = None class GeospatialDataType(BaseModel): - id: Optional[str] + id: Optional[str] = None title: Optional[str] = None - description: Optional[str] - keywords: Optional[List[str]] + description: Optional[str] = None + keywords: Optional[List[str]] = None dataType: DataTypeEnum = DataTypeEnum.VECTOR - geometryDimension: Optional[GeometryDimensionEnum] - maxTileMatrix: Optional[str] - minTileMatrix: Optional[str] - minScaleDenominator: Optional[float] - maxScaleDenominator: Optional[float] - minCellSize: Optional[float] - maxCellSize: Optional[float] - boundingBox: Optional[TwoDBoundingBoxType] - links: Optional[LinkType] - propertiesSchema: Optional[dict] + geometryDimension: Optional[GeometryDimensionEnum] = None + maxTileMatrix: Optional[str] = None + minTileMatrix: Optional[str] = None + minScaleDenominator: Optional[float] = None + maxScaleDenominator: Optional[float] = None + minCellSize: Optional[float] = None + maxCellSize: Optional[float] = None + boundingBox: Optional[TwoDBoundingBoxType] = None + links: Optional[LinkType] = None + propertiesSchema: Optional[dict] = None class StyleType(BaseModel): - id: Optional[str] - title: Optional[str] - description: Optional[str] - keywords: Optional[List[str]] - links: Optional[LinkType] + id: Optional[str] = None + title: Optional[str] = None + description: Optional[str] = None + keywords: Optional[List[str]] = None + links: Optional[LinkType] = None class TilePointType(BaseModel): crs: str - coordinates: Optional[List[float]] - scaleDenominator: Optional[float] - cellSize: Optional[float] + coordinates: Optional[List[float]] = None + scaleDenominator: Optional[float] = None + cellSize: Optional[float] = None # CodeType as adaptation of MD_Identifier class ISO 19115 tileMatrix: str - cellSize: Optional[str] + cellSize: Optional[str] = None class TileSetMetadata(BaseModel): # A title for this tileset - title: Optional[str] + title: Optional[str] = None # Brief narrative description of this tile set - description: Optional[str] + description: Optional[str] = None # keywords about this tileset - keywords: Optional[List[str]] + keywords: Optional[List[str]] = None # Version of the Tile Set. Changes if the data behind the tiles # has been changed - version: Optional[str] + version: Optional[str] = None # Useful information to contact the authors or custodians for the Tile Set - pointOfContact: Optional[str] + pointOfContact: Optional[str] = None # Short reference to recognize the author or provider - attribution: Optional[str] + attribution: Optional[str] = None # License applicable to the tiles - license_: Optional[str] + license_: Optional[str] = None # Restrictions on the availability of the Tile Set that the user needs to # be aware of before using or redistributing the Tile Set accessConstraints: Optional[AccessConstraintsEnum] = AccessConstraintsEnum.UNCLASSIFIED # Media types available for the tiles - mediaTypes: Optional[List[str]] + mediaTypes: Optional[List[str]] = None # Type of data represented in the tileset dataType: DataTypeEnum = DataTypeEnum.VECTOR # Limits for the TileRow and TileCol values for each TileMatrix in the # tileMatrixSet. If missing, there are no limits other that the ones # imposed by the TileMatrixSet. If present the TileMatrices listed are # limited and the rest not available at all - tileMatrixSetLimits: Optional[TileMatrixLimitsType] + tileMatrixSetLimits: Optional[TileMatrixLimitsType] = None # Coordinate Reference System (CRS) - crs: Optional[str] + crs: Optional[str] = None # Epoch of the Coordinate Reference System (CRS) - epoch: Optional[int] + epoch: Optional[int] = None # Minimum bounding rectangle surrounding the tile matrix set, in the # supported CRS - boundingBox: Optional[TwoDBoundingBoxType] + boundingBox: Optional[TwoDBoundingBoxType] = None # When the Tile Set was first produced - created: Optional[datetime] + created: Optional[datetime] = None # Last Tile Set change/revision - updated: Optional[datetime] - layers: Optional[GeospatialDataType] + updated: Optional[datetime] = None + layers: Optional[GeospatialDataType] = None # Style involving all layers used to generate the tileset - style: Optional[StyleType] + style: Optional[StyleType] = None # Location of a tile that nicely represents the tileset. # Implementations may use this center value to set the default location # or to present a representative tile in a user interface - centerPoint: Optional[TilePointType] + centerPoint: Optional[TilePointType] = None # Tile matrix set definition - tileMatrixSet: Optional[str] + tileMatrixSet: Optional[str] = None # Reference to a Tile Matrix Set on an official source - tileMatrixSetURI: Optional[str] + tileMatrixSetURI: Optional[str] = None # Links to related resources. - links: Optional[List[LinkType]] + links: Optional[List[LinkType]] = None