-
Notifications
You must be signed in to change notification settings - Fork 181
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
STAC with proj extension and rotations in transform confuses TiTiler /stac endpoints #1074
Labels
bug
Something isn't working
Comments
Thanks @scottyhq 🙏 This is clearly a rio-tiler (maybe rasterio) issue. from rio_tiler.io import STACReader
In [3]: with STACReader("https://gist.githubusercontent.com/scottyhq/68c296ab3c6e7c6f97f0460629308ddf/raw/9a8c0ac6e7a3bbd89f9bb0fd9bfd32d689d2781a/titiler-proj.json") as src:
...: print(src.bounds)
...:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-5092201fd028> in <cell line: 1>()
----> 1 with STACReader("https://gist.githubusercontent.com/scottyhq/68c296ab3c6e7c6f97f0460629308ddf/raw/9a8c0ac6e7a3bbd89f9bb0fd9bfd32d689d2781a/titiler-proj.json") as src:
2 print(src.bounds)
3
~/Dev/CogeoTiff/rio-tiler/rio_tiler/io/stac.py in __init__(self, input, item, tms, minzoom, maxzoom, include_assets, exclude_assets, include_asset_types, exclude_asset_types, default_assets, reader, reader_options, fetch_options, ctx)
23 self.fetch_options = __attr_factory_fetch_options()
24 self.ctx = ctx
---> 25 self.__attrs_post_init__()
~/Dev/CogeoTiff/rio-tiler/rio_tiler/io/stac.py in __attrs_post_init__(self)
279 self.height, self.width = self.item.ext.proj.shape
280 self.transform = self.item.ext.proj.transform
--> 281 self.bounds = array_bounds(self.height, self.width, self.transform)
282 self.crs = rasterio.crs.CRS.from_string(self.item.ext.proj.crs_string)
283
~/Dev/venv/py39/lib/python3.9/site-packages/rasterio/transform.py in array_bounds(height, width, transform)
202 else:
203 c0x, c0y = c, f
--> 204 c1x, c1y = transform * (0, height)
205 c2x, c2y = transform * (width, height)
206 c3x, c3y = transform * (width, 0)
TypeError: can't multiply sequence by non-int of type 'tuple' I'll cannot transfer the issue to the rio-tiler repo but it's fine to keep it here for now |
This was referenced Jan 22, 2025
thanks @scottyhq This is now fixed by cogeotiff/rio-tiler#781 and I'll trigger a new deploy for titiler.xyz later today |
Amazing! thanks for the explanation and quick turnaround @vincentsarago |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem description
I am getting a confusing 500 Error:
"detail": "can't multiply sequence by non-int of type 'tuple'"
on some STAC items which I spent some time digging into and it seems to be coming from havingproj:transform
fields present with rotations.Here is a reproducer with public data:
https://umbra-open-data-catalog.s3.amazonaws.com/sar-data/tasks/Panama+Canal,+Panama/bb17c467-a6a8-41f0-80d8-2da88af9475b/2024-02-15-03-30-26_UMBRA-06/2024-02-15-03-30-26_UMBRA-06_GEC.tif
(yes the spaces in the file names are very annoying !):
/cog/bounds
work as expected:/cog/stac
works/stac/bounds
returns an error for STAC with proj extension/stac/bounds
Works without proj extension!I spent a bit of time trying to figure out where this error is coming from but couldn't figure out the code path... For convenience I've posted the two STACs here
https://gist.github.com/scottyhq/68c296ab3c6e7c6f97f0460629308ddf
Expected Output
Same results for
/cog/bounds
and/stac/bounds
Environment Information
titiler.xyz
The text was updated successfully, but these errors were encountered: