Skip to content

Commit f6f2142

Browse files
authored
Merge pull request #386 from Labelbox/geo-bounds
updating docstring of tiledbounds class and also changing validator t…
2 parents c00f1b6 + 5251c88 commit f6f2142

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

labelbox/data/annotation_types/data/tiled_image.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,15 @@ 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.
51+
Bounds should be Point objects.
5252
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]]
55-
56-
>>> bounds = TiledBounds(
57-
epsg=EPSG.4326,
58-
bounds=[Point(x=0, y=0),Point(x=100, y=100)]
59-
)
53+
>>> bounds = TiledBounds(epsg=EPSG.EPSG4326,
54+
bounds=[
55+
Point(x=-99.21052827588443, y=19.405662413477728),
56+
Point(x=-99.20534818927473, y=19.400498983095076)
57+
])
6058
"""
6159
epsg: EPSG
6260
bounds: List[Point]
@@ -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)