[gdal-dev] Image compositing in VRT files

Alain Cembro acembro at yahoo.com
Fri Feb 11 08:03:49 EST 2011


Hello Jorge,


--- On Fri, 2/11/11, Jorge Arévalo <jorge.arevalo at deimos-space.com> wrote:

> You probably can use gdal_vrtmerge.py script in this way:
> 
> gdal_vrtmerge.py -o out.vrt <list of tiff files>
> 
> You can modify the out.vrt file to include only the bands
> you're interested in.

Sorry, it doesn't work :

If I put the roads.tif first, there is an exeption :

$ gdal_vrtmerge.py -o test.vrt roads.tif photos.tif           
Traceback (most recent call last):
  File "/usr/share/gdal/samples/gdal_vrtmerge.py", line 320, in <module>
    fi.write_source(t_fh, geotransform, xsize, ysize, band)
  File "/usr/share/gdal/samples/gdal_vrtmerge.py", line 150, in write_source
    data_type_name = gdal.GetDataTypeName(self.band_types[s_band]) 
IndexError: list index out of range

If I put the photos.tif first, a VRT file is created, but I can only see the roads on a white background instead of the photos background.

$ gdal_vrtmerge.py -o test.vrt photos.tif roads.tif 

More infos :

$ gdalinfo roads.tif 
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA 
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA 
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA 
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha

$ gdalinfo photos.tif 
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue

$ gdalinfo test.vrt   
Band 1 Block=128x128 Type=Byte, ColorInterp=Red
Band 2 Block=128x128 Type=Byte, ColorInterp=Green
Band 3 Block=128x128 Type=Byte, ColorInterp=Blue



      


More information about the gdal-dev mailing list