[gdal-dev] Raster Band Types

Even Rouault even.rouault at spatialys.com
Wed Sep 14 08:05:02 PDT 2016

Le mercredi 14 septembre 2016 16:43:51, Andrew Bell a écrit :
> Hi,
> Each raster band has a function to fetch the type of the raster band
> (GetRasterDataType).  This implies that various raster bands in a dataset
> can have differing data types.  But as far as I can tell, when creating a
> dataset and the associated raster bands, a single data type is specified
> for all of the raster bands in the dataset  (GDALDriver::Create).
> I don't
> see a way to create a dataset with raster bands of varying data types.  Is
> this supported?  If not, why not OR, why is the call to find the datatype
> on GDALRasterBand rather than GDALDataset?

A very small number of drivers (Memory, VRT, KEA) allow to add new bands on an 
existing dataset (possibly created with 0 bands at Create() time) with the 
GDALDataset::AddBand( GDALDataType eType, char** papszOptions ) API. You can 
use here a data type different from the one used at dataset creation.
For all other drivers that have creation capabilities, all bands will have the 
same data type. There might be some drivers that are read-only and can expose 
bands of different data types but none come to my mind currently (most of the 
time GDAL will select the "largest" data type and use if for all bands if the 
underlying format supports different data types per band)


Spatialys - Geospatial professional services

More information about the gdal-dev mailing list