[gdal-dev] Potential bug or misunderstanding. Please help

Billy Babis billybabis at gmail.com
Wed Jan 19 07:51:10 PST 2022


Hi there.

Given 3 input geotiffs (each with 2 bands), I want to create 1 geotiff with
3 bands (the 2nd band from each aforementioned geotiff). This should be
quite simple using gdal.BuildVRT and gdal.translate. But, gdal.BuildVRT
will not allow me to select the 2nd band from each input image. The
following code produces the following warning:

*Code:*
gdal.BuildVRT(output_vrt_fname, lst_of_input_geotiff_files, separate=True,
bandList=[2])

*Warning:*
 "fname.tif has 2 bands. Only the first one will be taken into account for
the -separate case"

Of course, I do not want to only use the first band, I want to use the 2nd
band to create the VRT. Please let me know what I'm doing wrong and how I
can fix it.

Best,
Billy B

-- 
Billy Babis
PhD Candidate: Environmental Economics & Policy (ABD)
Computer Science B.S.
1-(908)-403-2006
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220119/56c3b04c/attachment.html>


More information about the gdal-dev mailing list