Skip to content
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

Support multi-band GeoTiffs #283

Open
gillesserco opened this issue Nov 28, 2022 · 6 comments
Open

Support multi-band GeoTiffs #283

gillesserco opened this issue Nov 28, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@gillesserco
Copy link

Hello

I manage to use geotiffs as per the examples, that is making single band r/g/b files.

Is it possible to directly use the RGB geotiffs?

Thanks

best regards

Gilles

@dionhaefner dionhaefner changed the title Q: use rgb geotiffs dirrectly. Support multi-band GeoTiffs Nov 28, 2022
@dionhaefner
Copy link
Collaborator

Nope. If anyone has suggestions for a clean way to support this I may be swayed to implement it.

@gillesserco
Copy link
Author

ok, thanks for the quick reply. And more thanks for this nice tool...

@j08lue
Copy link
Collaborator

j08lue commented Dec 1, 2022

FWIW, our sister project TiTiler exposes the band index parameter bidx: https://developmentseed.org/titiler/endpoints/cog/. Not sure how to make RGB composites from several bands, though.

A way we could support this in Terracotta without changing the API would be to store an (optional) band index with each dataset you register, basically adding a line here:
https://github.com/DHI-GRAS/terracotta/blob/964a72b022bea565a10a73d6cce0a40542304a90/terracotta/drivers/relational_meta_store.py#L242-L248

and passing that value through to the raster reader.

Then you you could just register your multiple-band raster multiple times and assign a different band (or so) key value each time. Then you can render it as RGB the usual way: https://terracotta-python.readthedocs.io/en/latest/concepts.html#data-model.

That would mean zero change to the API, but would mean a change to the database schema.

@dionhaefner
Copy link
Collaborator

Interesting, that could work. I remember toying with something similar in #172.

IIRC my main concern was performance, it was my understanding that the COG standard required single-band files. But maybe that was a misread, or it got relaxed in the meantime.

@j08lue
Copy link
Collaborator

j08lue commented Dec 1, 2022

it was my understanding that the COG standard required single-band files

The GDAL COG driver mentions multi-band https://gdal.org/drivers/raster/cog.html#high-level

Not sure about the performance, though, especially if you only read one band at a time and not blocks of all three.

If we implemented the suggested method, we would have an easy way to test that. 😄

@mrpgraae
Copy link
Collaborator

mrpgraae commented Dec 2, 2022

it was my understanding that the COG standard required single-band files

The GDAL COG driver mentions multi-band https://gdal.org/drivers/raster/cog.html#high-level

Not sure about the performance, though, especially if you only read one band at a time and not blocks of all three.

If we implemented the suggested method, we would have an easy way to test that. 😄

Specifically, as a requirement for multi-band COGs, the driver documentation mentions that they should be written as pixel interleaved, which makes sense, as the driver can still read a block as one contiguous block of bytes and hence 1 HTTP range request.

@dionhaefner dionhaefner added the enhancement New feature or request label Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants