[Gdal-dev] spectrally subsetting

Frank Warmerdam warmerdam at pobox.com
Fri Jun 27 12:19:50 EDT 2003


Xiaodong Zhang wrote:

> Hi,
> 
> Just wondering how can I do a spectral subsetting with Gdal utilities. 
> For example. output a 7 band landsat image with only first 3 bands.

Hi,

The gdal_translate utility supports extracting a single band from a multi-band
source via the "-b <n>" commandline switch.  There is currently no super-handy
way of taking a selection of bands.  The gdal_merge.py utility (requires
python support) can be used to merge a set of single band files into a single
multi-band file.

It might be nice to modify the -b switch to support multiple bands, but I don't
see it happening immediately.

By the way, another way to do it would be to use gdal_translate to convert
to "vrt" format, which just writes out a little xml file describing where the
data should be read from.  You could then go into this and delete the bands
you don't want and then convert this vrt file to a real file format.

It can also be accomplished by scripting or at the C/C++ level of course.

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 Gdal-dev mailing list