You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Antimeridian-crossing Items and Searching For Them #296
Note that this bounding box is close to the 180 antimeridian, but doesn't cross it.
This query returns 6 items, but, it should return 12, as there are items that cover the right hand side of the box, but their geometry doesn't overlap, because it looks more like this:
Also note that that item has a bounding box of: [-180.67074549, -18.39115293, -178.55398222, -16.30174058].
Now, I thought I might be clever and put a little hack in when I'm searching close to the 180 degree antimeridian. But! If I do a query with values of less than -180 then I get an exception back from the STAC API:
APIError: 1 validation error for Request
body -> bbox
Bounding box must be within (-180, -90, 180, 90) (type=value_error)
So, there are STAC documents that have values in their geometry that I can't actually query against. Clearly this is a problem!
I'll have to check on which verison of stactools-packages/landsat we're on. It's possible we're on a version from before stactools-packages/landsat#30 and friends.
Unfortunately just searching for the desired pathrows via metadata (landsat:wrs_path / landsat:wrs_row) without any geometry in the query usually times out.
Absent fixes to the underlying stac items, one workaround for this (at least for landsat) is to:
Determine the landsat pathrows which intersect the (antimeridian crossing) region of interest. This is an exercise in and of itself!
Split the bounding box of those pathrows on the antimeridian.
Search on the split bboxes separately, and combine the results.
This should also accommodate the bad geometry for some stac items, which is in another issue I can't find right now. It also might be slightly liberal in some areas, based on the actual bounding boxes, so it might make sense to include the path/row filtering if you want strict results.
Unfortunately just searching for the desired pathrows via metadata (landsat:wrs_path / landsat:wrs_row) without any geometry in the query usually times out.
You're right. Querying for a year times out after 30 seconds... so this isn't a viable option either!
Matt McFarland (@mmcfarland) can you remind me: if the property_index_type field in pgstac.queryables is null, does that mean there isn't an index on that property?
Lack of an index on those fields means that querying on them isn't going to be too effective, the database will still have to scan everything before filtering.
Your best bet for now might be to break the query down into smaller time intervals:
Understood. We're trying to build a framework to do this kind of thing across the Pacific to develop a lot of products, so these kinds of workarounds are really not ideal. And if we're falling back to pathrow queries, then further breaking them down into small datetime ranges is an extra compromise. And it doesn't feel right, since I can currently query for 40 years of Landsat and get thousands of items returned without issue using a geometry query.
If they can have an index put on them, that would be great.
We'll need to check on the expected value there, but it probably shouldn't be less that -180? I'm not sure. stactools-packages/landsat#66 looks perhaps similar, but not identitcal.
Activity
alexgleith commentedon Nov 24, 2023
Note that one possible workaround is using pathrows for querying, but then I need a lookuptable for geometry -> pathrow.
Pathrow query looks like this:
Results in
6, 6so 12 scenes returned, which is what we want!alexgleith commentedon Nov 24, 2023
Another note that the USGS splits their geometry at the antimeridian, so that the queries work as expected.
Evidence in this very wide image!
Curiously, they return
16scenes, which is more than the12I could get on the MSPC.alexgleith commentedon Nov 25, 2023
The triangle of missing data in the below image is caused by the inability retrieve these items from the STAC API.
TomAugspurger commentedon Nov 27, 2023
I'll have to check on which verison of stactools-packages/landsat we're on. It's possible we're on a version from before stactools-packages/landsat#30 and friends.
jessjaco commentedon Dec 29, 2023
Unfortunately just searching for the desired pathrows via metadata (
landsat:wrs_path/landsat:wrs_row) without any geometry in the query usually times out.Absent fixes to the underlying stac items, one workaround for this (at least for landsat) is to:
This should also accommodate the bad geometry for some stac items, which is in another issue I can't find right now. It also might be slightly liberal in some areas, based on the actual bounding boxes, so it might make sense to include the path/row filtering if you want strict results.
alexgleith commentedon Jan 3, 2024
You're right. Querying for a year times out after 30 seconds... so this isn't a viable option either!
TomAugspurger commentedon Jan 3, 2024
Your best bet for now might be to break the query down into smaller time intervals:
That finished for me in ~55 seconds.
Matt McFarland (@mmcfarland) can you remind me: if the
property_index_typefield inpgstac.queryablesis null, does that mean there isn't an index on that property?Lack of an index on those fields means that querying on them isn't going to be too effective, the database will still have to scan everything before filtering.
alexgleith commentedon Jan 3, 2024
Understood. We're trying to build a framework to do this kind of thing across the Pacific to develop a lot of products, so these kinds of workarounds are really not ideal. And if we're falling back to pathrow queries, then further breaking them down into small datetime ranges is an extra compromise. And it doesn't feel right, since I can currently query for 40 years of Landsat and get thousands of items returned without issue using a geometry query.
If they can have an index put on them, that would be great.
TomAugspurger commentedon Jan 12, 2024
Matt confirmed that those fields are currently unindexed. We'll look into adding them.
Getting back to this, which I missed the first time: I think the item's geometry is incorrect:
We'll need to check on the expected value there, but it probably shouldn't be less that -180? I'm not sure. stactools-packages/landsat#66 looks perhaps similar, but not identitcal.
alexgleith commentedon Apr 5, 2024
Did this end up getting fixed Tom Augspurger (@TomAugspurger)? We have a workaround, so I think we're ok, but it would be nice if it was resolved.
TomAugspurger commentedon Apr 5, 2024
TomAugspurger commentedon May 16, 2024
We got the index added in
landsat:wrs_pathandlandsat:wrs_rowadded (finally). The example which timed out earlier is quick now:alexgleith commentedon May 28, 2024
Thanks, Tom Augspurger (@TomAugspurger), this is really nice!
I think this should stay open though, as the original issue is with some of the geometries/bounding boxes.
(Great to meet you the other day!)
ghidalgo3 commentedon Nov 8, 2024
Closeddue to inactivity, feel free to reopen if you would like to continue this discussion.