Skip to content

Commit 21e3890

Browse files
committed
fixup! BoundingBox: add cyclic_antimeridian_split
1 parent a71b946 commit 21e3890

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

openeo_driver/util/geometry.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -802,15 +802,16 @@ def intersection(self, other: "BoundingBox") -> Union["BoundingBox", None]:
802802

803803
def cyclic_antimeridian_split(self) -> List["BoundingBox"]:
804804
"""
805-
Split this bounding box into two bounding boxes
806-
when it uses cyclic longitude coordinates and crosses the antimeridian.
805+
When this bounding box uses cyclic longitude coordinates and crosses the antimeridian:
806+
split it into two bounding boxes for each side of the antimeridian.
807807
Otherwise, just return this bounding box as is.
808808
"""
809809
if self.cyclic_antimeridian_crossing():
810810
# TODO: this assumes "cyclic" implies longitude in degrees (EPSG:4326), and split is at +/-180
811+
west, east = normalize_west_east_longitude(west=self.west, east=self.east)
811812
return [
812-
BoundingBox(west=self.west, south=self.south, east=180, north=self.north, crs=self.crs),
813-
BoundingBox(west=-180, south=self.south, east=self.east, north=self.north, crs=self.crs),
813+
BoundingBox(west=west, south=self.south, east=180, north=self.north, crs=self.crs),
814+
BoundingBox(west=-180, south=self.south, east=east, north=self.north, crs=self.crs),
814815
]
815816
else:
816817
return [self]

0 commit comments

Comments
 (0)