-
Notifications
You must be signed in to change notification settings - Fork 12
Description
We are building a tutorial that uses pystac-client to query data from the ESRI LULC product, and then uses odc-stac to load it. Our area of interest is one of the Galapagos Islands, and we're running into an issue where our STAC query returns irrelevant supercells, because the geometry of those supercells has been incorrectly specified as multipolygons.
Specifically, supercells that span the antimeridian have been converted to incorrect multi-polygons, meaning that some part of the geometry overlaps our area of interest, despite being geographically nowhere near it.
You can see an example from a query I ran in the STAC Browser, and I have included some code below to help reproduce. In the image below, a spatial query on the Galapagos returns three super cells, where I would have expected one.
- 15M-2022 (expected, correct footprint)
- 01M-2022(not expected, malformed multipolygon footprint)
- 60M-2022(not expected, malformed multipolygon footprint)
Code to reproduce
AOI file as geojson provided below
import geopandas as gpd
import planetary_computer
from pystac_client import Client
aoi = gpd.read_file("aoi.geojson")
aoi_geometry = aoi.iloc[0].geometry
start_date = "2017-01-01"
end_date = "2023-01-01"
date_range = (start_date, end_date)
catalog_url = "https://planetarycomputer.microsoft.com/api/stac/v1/"
desired_collections = ["io-lulc-annual-v02"]
desired_assets = ["data"]
# Connect to the catalog
stac_client = Client.open(
url=catalog_url,
modifier=planetary_computer.sign_inplace,
)
# Search for items matching the query
items = stac_client.search(
collections=desired_collections,
intersects=aoi_geometry,
datetime=date_range,
).item_collection()
# Review ids and properties from query
item_properties = [(it.id, it.properties['proj:code'], it.geometry['type']) for it in items]
print(item_properties)Area of interest geoJSON:
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"coordinates": [
[
[
-91.58987956529757,
-0.5334850082123666
],
[
-91.58987956529757,
-1.0602980954159733
],
[
-90.77656229893003,
-1.0602980954159733
],
[
-90.77656229893003,
-0.5334850082123666
],
[
-91.58987956529757,
-0.5334850082123666
]
]
],
"type": "Polygon"
}
}
]
}
