GDAL virtual raster file

Frank Warmerdam fwarmerdam at GMAIL.COM
Tue Apr 12 12:07:28 PDT 2005


On Apr 12, 2005 2:44 PM, Nuno Gil <nunoragil at gmail.com> wrote:
> Dear Listers,
> I have some Landsat5 images in arcinfo grid format - they are
> separated by bands.
> I was trying to compose the bands together without creating more files.
> Is it possible to create a vrt GDAL virtual raster file from three
> different grid files (one for each visible band)?

Nuno, 

Yes, you can do this.  The "easiest" way would likely be to 
use gdal_translate to convert one of the files to VRT format.
Then hand edit that .vrt file, duplicating the band data for the 
additional two bands and editing the filenames, and band index
values accordingly. 

Copying to VRT with gdal_translate is done like this:

 gdal_translate -of VRT incover out.vrt 

This just makes a VRT file "linked" back to the source file, but
with all metadata and georeferencing duplicated in the VRT. 

> Is it possible afterwards to get MapServer to read it? What do I need
> to include in my map file?

Just reference the .vrt file.  

> Since I have a bunch of grids (5º x 5º) can I use something like
> gdaltindex to create a shapefile index for the virtual files?

Yes, you should be able to run gdaltindex on the .vrt's normally.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the MapServer-users mailing list