Skip to content

Commit ac313cf

Browse files
committed
Merge branch 'main' of https://github.com/stac-utils/stac-pydantic into release/v3.1.5
2 parents eff0118 + 2250021 commit ac313cf

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

Diff for: stac_pydantic/api/search.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,15 @@ def validate_bbox(cls, v: BBox) -> BBox:
8787
raise ValueError(
8888
"Maximum elevation must greater than minimum elevation"
8989
)
90-
91-
if xmax < xmin:
92-
raise ValueError(
93-
"Maximum longitude must be greater than minimum longitude"
94-
)
90+
# Validate against WGS84
91+
if xmin < -180 or ymin < -90 or xmax > 180 or ymax > 90:
92+
raise ValueError("Bounding box must be within (-180, -90, 180, 90)")
9593

9694
if ymax < ymin:
9795
raise ValueError(
9896
"Maximum longitude must be greater than minimum longitude"
9997
)
10098

101-
# Validate against WGS84
102-
if xmin < -180 or ymin < -90 or xmax > 180 or ymax > 90:
103-
raise ValueError("Bounding box must be within (-180, -90, 180, 90)")
104-
10599
return v
106100

107101
@field_validator("datetime", mode="after")

Diff for: tests/api/test_search.py

-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ def test_search_geometry_bbox():
147147
"bbox",
148148
[
149149
(100.0, 1.0, 105.0, 0.0), # ymin greater than ymax
150-
(100.0, 0.0, 95.0, 1.0), # xmin greater than xmax
151150
(100.0, 0.0, 5.0, 105.0, 1.0, 4.0), # min elev greater than max elev
152151
(-200.0, 0.0, 105.0, 1.0), # xmin is invalid WGS84
153152
(100.0, -100, 105.0, 1.0), # ymin is invalid WGS84

0 commit comments

Comments
 (0)