Skip to content

Add INTERLEAVE=BAND option to COG driver #10859

@jakimowb

Description

@jakimowb

Feature description

Request

It is requested to enhance the COG driver by an option to create COG rasters with band interleave, i.e. an creation option INTERLEAVE=BAND, similar those existing in the GTiff driver.

Problem

According to the OGC COG specification, COGs with multiple bands may be stored with pixel interleave (BIP) or band interleave (BSQ).

When more than one component is encoded in a TIFF file, the TIFF provides two possibilities.

  1. The component values for each pixel are stored contiguously.
    This is marked in the file as PlanarConfiguration=Contig (a.k.a. Chunky format, value 1).
    This is a common arrangement for RGB combinations of bands. The data is stored as
    RGBRGBRGB… (this arrangement is also known as Band Interleaved by Pixel, BIP).

  2. The components are stored in separate component planes. This is marked in the file
    as PlanarConfiguration=Separate (a.k.a. Planar format, value 2). This is the common
    arrangement for the bands of a multispectral image (this arrangement is also known
    as Band Sequential, BSQ).

By now (GDAL 3.9.2), the COG driver supports BIP only. Unfortunatelly, COGs generated in this way for multiband datsets, e.g. hyperspectral satellite data with more than 100 bands, cannot be visualized smoothly. The loading times for block-by-block band information, e.g. to visualize them in QGIS, are simply too long.

Workaround

A current workaround to create BSQ COGs for such kind of raster data is to:

  1. use the GTiff driver and create a raster with TILED=YES and INTERLEAVE=BAND
  2. run gdaladdo to create overview images
  3. run cogger to create the COG images
    (these images validate agains osgeo_utils.samples.validate_cloud_optimized_geotiff)

How to reproduce

  1. Start QGIS
  2. Open Datasource Manager -> Raster -> Protocol
  3. add url to this BSQ COG (created with GDAL + cogger) ENMAP01-____L2A-DT0000001867_20220724T104526Z_008_V010302_20230628T165614Z-SPECTRAL_IMAGE.BSQ_COG.tiff. This BSQ COG was created with the workaround described above. However, it would be nice if GDAL could create these BSQ COGs itself.
  4. zoom to native resolution and apply this *.qml style ENMAP01-____L2A-DT0000001867_20220724T104526Z_008_V010302_20230628T165614Z-SPECTRAL_IMAGE.BSQ_COG.qml to optimize visualization
  5. zoom and pan around to get a feeling for the loading times.
  6. Now repeat steps 3-6 with the BIP COG ENMAP01-____L2A-DT0000001867_20220724T104526Z_008_V010302_20230628T165614Z-SPECTRAL_IMAGE.BIP_COG.tiff. This image was created with the GDAL COG driver (GDAL 3.9.2.).

grafik

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions