[gdal-dev] How to make VRT offsite areas white?

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Mon May 28 06:03:29 PDT 2012


Hi,

I thought this would be easy but it was not.

I have a mosaic of images which do not fill the whole bounding box of the area.
I made a .VRT file the images and converted the virtual raster into geotiff. Now
I have a nice mosaic but it has black boxes in the areas where I do not have
source data. An example of the result is here
http://latuviitta.org/documents/nodata_3.tif

I would rather paint nodata areas with white instead of black. But how can I
make it? I thought that gdalwarp -dstnodata would do it but areas of missing
source data remains black
gdalwarp -dstnodata "255,255,255" nodata.vrt nodata_3.tif

The following command does make the black box white but unfortunately is is also
changing everything that was black in the orininal images, including all the
texts, into white:
gdalwarp -dstnodata "255,255,255" -srcnodata "0,0,0" nodata.vrt nodata_3.tif

So what is the correct way to do this simple task?

-Jukka Rahkonen-






More information about the gdal-dev mailing list