Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I create a multispectral image file (in band sequential (BSQ) format), from several 1-band images, using GDAL libraries? I work with C++ language. Thanks for your attention.

share|improve this question

From C++ you can create your output file using GDALDriver::Create() to imperatively create your multi-band output file. Then open each of your input files in turn read the band of image data with GDALRasterBand::RasterIO(), and then write it to the appropriate output band in the output file. This assumes each band isn't too large to hold in RAM.

If you want to copy over a band in chunks you could do it yourself, our you might consider using GDALRasterBandCopyWholeRaster() which will do it in reasonable sized chunks with an optional progress monitor.

The gdal_translate program actually accomplishes copies in a much more complicated way where it forms a VRTDataset referencing the source image and then uses CreateCopy() from that, but this complication is mostly just of value if you want to write to a format that does not support GDALDriver::Create() so that you need to use GDALDriver::CreateCopy() instead. For instance many compressed formats. But if you just want to create a raw BSQ format like ESRI BIL that is not required.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.