Skip to content

bbox and proj:bbox are incorrect for antimeridian-crossing scenes #66

@philvarner

Description

@philvarner

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

  1. Generate metadata for a scene over the antimeridain
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions