Creating a Raster Stack that will save tif filenames as band names in GDAL

389 views Asked by At

I created a raster stack but i can't set the band names as I desired. I use this code for stacking with Python:

outvrt = ('result/raster_stack_vrt.tif')
outtif = ('result/raster_stack.tif')
tifs = glob.glob('data/*.tif')
outds = gdal.BuildVRT(outvrt, tifs, separate = True)
outds = gdal.Translate(outtif, outds)

Automatic generation of band names can sometimes be confusing. So I want to set the band names to be the same as the name of the tif file of each band when creating raster stack. Is it possible?

Thanks.

0

There are 0 answers