-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
possible to inadvertently drop item when proj:bbox
is much larger than target bbox in another projection
#205
Comments
Thanks for reporting @hrodmn, and thanks for the nice explanation. I think there are 2 things in this issue:
This definitely needs to be fixed! Just densifying the bounding-box before reprojecting it should solve the issue you're facing here.
Anyway, what to do:
|
TLDR: Would it be possible to filter STAC items using
proj:geometry
instead ofproj:bbox
in prepare_items? This would make it possible to use more than four reprojected polygon coordinates to check overlap between the targetbbox
and the STAC items.I have a STAC collection where the items/assets are stored in 15 degree squares in epsg:4326. This might be a terrible storage scheme, but it creates a situation where data gets inadvertently dropped when loading it with
stackstac.stack
. I can make a reprex if it would be useful but for now I will just start with a description of the problem.My AOI is fairly small and is defined in epsg:5070. This AOI happens to straddle the 45th parallel, so it is on the border between two of my STAC items. When I load the data via
stackstac
, one of the items gets dropped presumably because, after reprojecting to epsg:5070, the itemproj:bbox
does not overlap the AOI'sbbox
.Here is a python script that illustrates the situation:
After reprojection from epsg:4326 to epsg:5070, the boundary between the STAC item geometries has shifted north of the 45th parallel!
If I reproject the aoi to epsg:4326, everything looks as expected!
@pjhartzell recently wrote an article about this exact problem and shared how the stactools package addresses it by densifying the STAC item geometry. I tried that and it seems to fix my issue. Now the STAC item geometries still track the 45th parallel after being reprojected.
If stackstac were to read
proj:geometry
instead ofproj:bbox
to check for overlap between items and the targetbbox
we could avoid this edge case!The text was updated successfully, but these errors were encountered: