@@ -22,18 +22,27 @@ class EPSG(Enum):
2222class TiledBounds (BaseModel ):
2323 """ Bounds for a tiled image asset related to the relevant epsg.
2424
25- Each bound is a list of Point objects.
25+ Bounds should be Point objects
2626
2727 If version of asset is 2, these should be [[lat,lng],[lat,lng]]
2828 If version of asset is 1, these should be [[lng,lat]],[lng,lat]]
2929
3030 >>> bounds = TiledBounds(
31- epsg=EPSG.4326,
32- bounds=[[0,0],[ 100,100] ]
31+ epsg=EPSG.4326,
32+ bounds=[Point(x=0, y=0),Point(x= 100, y= 100) ]
3333 )
3434 """
3535 epsg : EPSG
36- bounds : List [List [Point ]]
36+ bounds : List [Point ]
37+
38+ @validator ('bounds' )
39+ def validate_bounds (cls , bounds ):
40+ first_bound = bounds [0 ]
41+ second_bound = bounds [1 ]
42+
43+ if first_bound == second_bound :
44+ raise AssertionError (f"Bounds cannot be equal, contains { bounds } " )
45+ return bounds
3746
3847
3948class TileLayer (BaseModel ):
@@ -42,22 +51,16 @@ class TileLayer(BaseModel):
4251 https://c.tile.openstreetmap.org/{z}/{x}/{y}.png
4352
4453 >>> layer = TileLayer(
45- url=https://c.tile.openstreetmap.org/{z}/{x}/{y}.png,
54+ url=" https://c.tile.openstreetmap.org/{z}/{x}/{y}.png" ,
4655 name="slippy map tile"
4756 )
4857 """
4958 url : str
5059 name : Optional [str ] = "default"
5160
52- def from_dict ():
53- pass
54-
55- def to_dict ():
56- pass
57-
5861 @validator ('url' )
5962 def validate_url (cls , url ):
6063 xyz_format = "/{z}/{x}/{y}"
6164 if xyz_format not in url :
62- raise AssertionError (f"{ self . url } needs to contain { xyz_format } " )
65+ raise AssertionError (f"{ url } needs to contain { xyz_format } " )
6366 return url
0 commit comments