[Gdal-dev] band concept of GDAL data model

Frank Warmerdam warmerdam at pobox.com
Sun Dec 28 11:46:50 EST 2003


wang liyan wrote:
> 
> Hi,
> 
>   What I want is to change a one-band image into a image with 4 bands 
> image.
>   I have already read the image data by using RasterIO method,the type 
> of origion
> image is GDT_Byte.Then how to create an 4 bands image which type is 
> GDT_Float32?
> 
> I have read the GDAL data model for several times.But i don't quiet 
> understand it.
> 
> Can any experts help me?
> 
>    Thanks in advanced!
>                                       jeff

Jeff,

The details will vary but basically you would use the Create()
method on the GDALDriver class to create a new file with the
desired dimensions, number of bands and band data type, and then
use the RasterIO() method to read from your source file and then
write to your destination file.  You will need to review the API
documentation to do some of this.  The tutorial should cover much
of what you need:

  http://www.remotesensing.org/gdal/gdal_tutorial.html

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