Skip to content

Commit ded9854

Browse files
committed
updating docstring of tiledbounds class and also changing validator to be specific to 4326
1 parent c00f1b6 commit ded9854

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

labelbox/data/annotation_types/data/tiled_image.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,14 @@ class EPSG(Enum):
4646

4747

4848
class TiledBounds(BaseModel):
49-
""" Bounds for a tiled image asset related to the relevant epsg.
49+
""" Bounds for a tiled image asset related to the relevant epsg.
5050
51-
Bounds should be Point objects. Currently, we support bounds in EPSG 4326.
52-
53-
If version of asset is 2, these should be [[lat,lng],[lat,lng]]
54-
If version of asset is 1, these should be [[lng,lat]],[lng,lat]]
51+
Bounds should be Point objects.
52+
Currently, we support bounds in EPSG 4326. These should be [[lat,lng],[lat,lng]]
5553
5654
>>> bounds = TiledBounds(
5755
epsg=EPSG.4326,
58-
bounds=[Point(x=0, y=0),Point(x=100, y=100)]
56+
bounds=[Point(x=0, y=0),Point(x=30, y=30)]
5957
)
6058
"""
6159
epsg: EPSG
@@ -72,13 +70,13 @@ def validate_bounds_not_equal(cls, bounds):
7270
f"Bounds on either axes cannot be equal, currently {bounds}")
7371
return bounds
7472

75-
#bounds are assumed to be in EPSG 4326 as that is what leaflet assumes
73+
#validate bounds are within lat,lng range if they are EPSG4326
7674
@root_validator
7775
def validate_bounds_lat_lng(cls, values):
7876
epsg = values.get('epsg')
7977
bounds = values.get('bounds')
8078

81-
if epsg != EPSG.SIMPLEPIXEL:
79+
if epsg == EPSG.EPSG4326:
8280
for bound in bounds:
8381
lat, lng = bound.y, bound.x
8482
if int(lng) not in VALID_LNG_RANGE or int(

0 commit comments

Comments
 (0)