-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing pydantic validation issue of tilejson metadata (#1421)
* - on MVTilejson model, set default value on optional fields, so that they are not required. * - fixed formatting (flake8) * Update base.py --------- Co-authored-by: doublebyte1 <[email protected]> Co-authored-by: Francesco Bartoli <[email protected]>
- Loading branch information
1 parent
532d4bf
commit f1a0357
Showing
2 changed files
with
59 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,10 @@ | |
# ================================================================= | ||
# | ||
# Authors: Antonio Cerciello <[email protected]> | ||
# Francesco Bartoli <[email protected]> | ||
# | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters