[gdal-dev] creating multi banded imagery

Lucena, Ivan ivan.lucena at pmldnet.com
Mon May 12 20:45:03 EDT 2008


Jared,

The forth parameter on "Create" is actually the number of bands but will 
not going to work for driver/formats that does not support multi-band. 
If you want to use NITF you should check the docs.

 >>> dst = driver.Create(' ', 10, 10, *10*, GDT_UInt16)

Best regards,

Ivan

Refs.:

http://www.gdal.org/classGDALDriver.html#191dc4a5c8f48c1dea4083c711b8f7c4
http://www.gdal.org/formats_list.html

Jared Rubin wrote:
> Dear group,
>   Is there a gdal format that allows for n-banded imagery? So something like 
> the following in python in which I attempt to create a 10 banded image?
> thanks
> 
> import sys,os,string,shutil
> import osgeo.gdal
> from osgeo.gdalconst import *
> import numpy
> from numpy import *
> 
> buf = zeros((10,10))
> driver = osgeo.gdal.GetDriverByName('NITF')
> dst = driver.Create('tmp.nitf', 10, 10, 1, osgeo.gdal.GDT_UInt16)
> dst.GetRasterBand(1).WriteArray(buf)
> dst.GetRasterBand(2).WriteArray(buf)
> dst.GetRasterBand(3).WriteArray(buf)
> dst.GetRasterBand(4).WriteArray(buf)
> dst.GetRasterBand(5).WriteArray(buf)
> dst.GetRasterBand(6).WriteArray(buf)
> dst.GetRasterBand(7).WriteArray(buf)
> dst.GetRasterBand(8).WriteArray(buf)
> dst.GetRasterBand(9).WriteArray(buf)
> dst.GetRasterBand(10).WriteArray(buf)
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 


More information about the gdal-dev mailing list