-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
COG: add support for INTERLEAVE=BAND and TILE #11541
base: master
Are you sure you want to change the base?
Conversation
a00b736
to
2cb6551
Compare
Just FYI @joanma747 (this doesn't violate anything in the OGC COG spec which allow PlanarConfiguration=Separate as a potential option) |
2cb6551
to
e4c4770
Compare
@rouault I'm confused about "INTERLEAVE=TILE; COG". Do you intend that there be a semi-colon in the option value or is this just a shorthand way of naming the feature in discussion? |
yes, should read:
Or said differently, with this PR, both GTIFF and COG drivers support INTERLEAVE=PIXEL/BAND/TILE |
TILE looks good to me for COG. Just to make sure I understand correctly: TILE and BAND are identical for GTIFF, they only differ for COG, right? (the actual layout /may/ differ between TILE/BAND for GTIFF, but said layout is not specified/enforced in this case) |
Good question. Actually that's a bit subtle. TILE is identical for GTIFF and COG, but for GTIFF, it can only be used in CreateCopy() mode (an error will be emitted at runtime if trying to use it in Create() mode. Also documented at https://github.com/OSGeo/gdal/pull/11541/files#diff-c98fddcda04a8dab184552a28d2b386d941862584daeb6a5b39e9cabdeaaac5dR484). Because in Create() "random" update mode, we can only guarantee the PlanarConfiguration=Separate TIFF setting, and not that the TILE interleaving (which would be dependent on the order users fill blocks, and would require the block cache to honour to be aware of the appropriate order in which to evict dirty blocks). |
I'm not sure it's a good idea to start introducing layout options for GTIFF : won't we end up implementing a second COG driver? For me TILE should either be unsupported for GTiff, or an exact alias of BAND. This is a nitpick however, not a hill I will die for. |
actually, the COG driver is mostly an empty shell that forwards all the heavy work to the GTiff one, so this has to be supported in some way by the GTiff driver. But I see your point. I could possibly make INTERLEAVE=TILE an undocumented option of the GTiff driver, that only the COG driver would be supposed to make use of it. |
@rouault thank you for that implementation. It all looks very good to me, but unfortunately I don't have the possibility to compile and test it locally at the moment. I like the descriptions that were added to doc/source/drivers/raster/cog.rst and doc/source/drivers/raster/gtiff.rst |
…RLEAVE=BAND Fixes OSGeo#10859 Up to now the COG driver only produced INTERLEAVE=PIXEL / PlanarConfiguration=Contiguous files where values for all bands are in the same tile. This PR add supports for INTERLEAVE=BAND where the tiles of band 1 are placed first, followed by the ones of band 2, etc. It also introduces a INTERLEAVE=TILE mode, which is similar to the BIL (Band Interleave by Line), but generalize to tiles. That is you put first tile (x,y)=(0,0) of band 1, then tile (0, 0) of band 2, ... tile (0, 0) of band N, tile (1, 0) of band 1, ... tile (1, 0) of band N, etc. Both modes can be useful for hyper-spectral datasets for example.
e4c4770
to
a3d090e
Compare
I've just done that |
Fixes #10859
Up to now the COG driver only produced INTERLEAVE=PIXEL / PlanarConfiguration=Contiguous files where values for all bands are in the same tile. This PR add supports for INTERLEAVE=BAND where the tiles of band 1 are placed first, followed by the ones of band 2, etc. It also introduces a INTERLEAVE=TILE mode, which is similar to the BIL (Band Interleave by Line), but generalized to tiles. That is you put first tile (x,y)=(0,0) of band 1, then tile (0, 0) of band 2, ... tile (0, 0) of band N, tile (1, 0) of band 1, ... tile (1, 0) of band N, etc. Both modes can be useful for hyper-spectral datasets for example.
I'm not totally sure about the naming for INTERLEAVE=TILE. Open to suggestions