support antimeridian bbox cases (#837)

This commit is contained in:
Tom Kralidis
2022-01-03 08:25:37 -05:00
committed by GitHub
parent 30a626ba9d
commit 1b508c77cd
2 changed files with 9 additions and 2 deletions
+6 -2
View File
@@ -3237,11 +3237,15 @@ def validate_bbox(value=None) -> list:
LOGGER.debug(msg)
raise
if bbox[0] > bbox[2] or bbox[1] > bbox[3]:
msg = 'min values should be less than max values'
if bbox[1] > bbox[3]:
msg = 'miny should be less than maxy'
LOGGER.debug(msg)
raise ValueError(msg)
if bbox[0] > bbox[2]:
msg = 'minx is greater than maxx (possibly antimeridian bbox)'
LOGGER.debug(msg)
return bbox
+3
View File
@@ -1504,6 +1504,9 @@ def test_validate_bbox():
assert (validate_bbox('-142.1,42.12,-52.22,84.4') ==
[-142.1, 42.12, -52.22, 84.4])
assert (validate_bbox('177.0,65.0,-177.0,70.0') ==
[177.0, 65.0, -177.0, 70.0])
with pytest.raises(ValueError):
validate_bbox('1,2,4')