[gdal-dev] Can RasterIO write one band at a time or must I combine my separate R,G,B buffers first?

Kyle Shannon ksshannon at gmail.com
Wed Feb 8 11:05:47 EST 2012


Ethan, you can fetch single bands using GDALRasterBand* poBand =
GetRasterBand(1) and use poBand->RasterIO(...).  See docs here:

http://gdal.org/classGDALRasterBand.html


/**
 *
 * Kyle Shannon
 * ksshannon at gmail.com
 *
 */



On Wed, Feb 8, 2012 at 08:39, Ethan <ethanfahy at gmail.com> wrote:

> I am writing a C++ program that reads in 3 separate single band geotiffs,
> applies some math to them, then outputs a single geotiff files that
> contains
> the data from those 3 files in the bands 1,2 and 3.  I've so far set up the
> code to follow the methods from the gdal api tutorial and have read in the
> values from each of the 3 geotiffs to 3 separate buffers.  When it comes
> time to use RasterIO to write to my single output geotiff, is there any way
> to write one band at a time?  Or is there any way to use the RasterIO
> function without first combining my 3 buffers into a single buffer?  For me
> the RasterIO documentation is a little unclear when it describes:
>        nBandCount      the number of bands being read or written.
>        panBandMap      the list of nBandCount band numbers being
> read/written. Note
> band numbers are 1 based. This may be NULL to select the first nBandCount
> bands.
>
> Thanks in advance for any help it's much appreciated.
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/Can-RasterIO-write-one-band-at-a-time-or-must-I-combine-my-separate-R-G-B-buffers-first-tp4376337p4376337.html
> Sent from the GDAL - Dev mailing list archive at Nabble.com.
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120208/20a5490f/attachment.html


More information about the gdal-dev mailing list