stactools is creating weird geometries for scenes crossing the antimeridian.
Using the following query:
( footprint:"Intersects(POLYGON((179.85981205988597 -16.31364078726581,180 -16.31364078726581,180 -16.0913663114235,179.85981205988597 -16.0913663114235,179.85981205988597 -16.31364078726581)))" OR footprint:"Intersects(POLYGON((-180 -16.31364078726581,-179.86673370370877 -16.31364078726581,-179.86673370370877 -16.0913663114235,-180 -16.0913663114235,-180 -16.31364078726581)))" ) AND ( beginPosition:[2023-08-15T00:00:00.000Z TO 2023-08-21T23:59:59.999Z] AND endPosition:[2023-08-15T00:00:00.000Z TO 2023-08-21T23:59:59.999Z] ) AND ( (platformname:Sentinel-2 AND producttype:S2MSI2A))
In Copernicus Open Access Hub, I downloaded several scenes. Two of them, S2A_MSIL2A_20230821T221941_N0509_R029_T01KAB_20230822T021825 and S2A_MSIL2A_20230821T221941_N0509_R029_T01LAC_20230822T021825, crosses the antimeridian.
Let's take S2A_MSIL2A_20230821T221941_N0509_R029_T01KAB_20230822T021825, in its product metadata file we can find the following EXT_POS_LIST:
stactools
is creating weird geometries for scenes crossing the antimeridian.Using the following query:
In Copernicus Open Access Hub, I downloaded several scenes. Two of them,
S2A_MSIL2A_20230821T221941_N0509_R029_T01KAB_20230822T021825
andS2A_MSIL2A_20230821T221941_N0509_R029_T01LAC_20230822T021825
, crosses the antimeridian.Let's take
S2A_MSIL2A_20230821T221941_N0509_R029_T01KAB_20230822T021825
, in its product metadata file we can find the followingEXT_POS_LIST
:Using the following code, I get what I think is the right geometry for the scene:
Which result in this geometry:
Projecting the geometry on a map:
On the other hand, if I create a STAC item using
stac sentinel2
I get the following geometry:In a map, it looks like:
Zooming in the map, we can see the geometry is not correct and it doesn't cover the whole area:
I'm not 100% sure if the issue is in
stactools-packages/sentinel2
or instac-utils/stactools
.