[gdal-dev] gdalbuildvrt : addalpha adds a new band even if not needed

Christophe Guédas cguedas at gmail.com
Mon Nov 14 01:28:07 PST 2022


Hello,
I'm using gdalbuildvrt to create a virtual raster from multiple tiff tiles.
I need the output virtual raster to have an alpha band, and as I do not
know beforehand if the input rasters will contain one or not, I use the
'addalpha' option of gdalbuildvrt to add one if needed.
As I understand the documentation of gdalbuildvrt, 'Adds an alpha mask band
to the VRT when the source raster have none' means that if the source
rasters already have an alpha band, no new band should be added.
However, when I run the following command on the attached test files (that
already contain an alpha band) :
gdalbuildvrt -addalpha test.vrt 1.tiff 2.tiff
The result vrt contains a fifth band, and thus two alpha bands.

Do I misunderstand the gdalbuildvrt documentation, or is there a problem
with my input files ?

I tested this with GDAL v3.0.4 provided in the ubuntu 20.04 repository, as
well as with GDAL v3.6.0dev-cc78d80d5df3750db317b96d93013d5f70ef6f0a from
the osgeo/gdal:latest docker image.

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221114/7a96ddb0/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.tiff
Type: image/tiff
Size: 1512 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221114/7a96ddb0/attachment.tiff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.tiff
Type: image/tiff
Size: 1512 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20221114/7a96ddb0/attachment-0001.tiff>


More information about the gdal-dev mailing list