-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Describe the bug
bbox and proj:bbox are incorrect for antimeridian-crossing scenes
For example, this item https://earth-search.aws.element84.com/v1/collections/landsat-c2-l2/items/LC09_L2SR_074069_20231202_02_T2
has geometry
{
"type": "MultiPolygon",
"coordinates": [
[
[
[
-180,
-13.959297847971616
],
[
-179.52630375390157,
-14.05925204290674
],
[
-179.1508548158289,
-12.324431209402446
],
[
-180,
-12.146105277305576
],
[
-180,
-13.959297847971616
]
]
],
[
[
[
180,
-12.146105277305576
],
[
179.16755667528403,
-11.97128684276108
],
[
178.7800788630643,
-13.701883447644253
],
[
180,
-13.959297847971616
],
[
180,
-12.146105277305576
]
]
]
]
}
but bbox
[
110.735828,
-14.081215,
-111.134293,
-11.948248
],
This bbox correctly has a SW longitude that is to the east of the NE longitude, as the bbox should cross the antimeridian. The bbox does cover the geometry (I think?), however, the bbox spans ~222 deg longitude, when it should span ~3 deg.
I don't have an example of the proj:bbox for this, but I can see from the code that it's wrong, since it does a simple min/max calculation, not accounting for the SW-east-of-NE longitude issue with antimeridian-spanning scenes.
def proj_bbox(self) -> List[float]:
...
return [min(xs), min(ys), max(xs), max(ys)]
To reproduce
- Generate metadata for a scene over the antimeridain
- see that bbox and proj:bbox and geometry don't match
Expected behavior
The bbox and proj:bbox compactly represent the antimeridian-spanning scene geometry.