[gdal-dev] Geotiff FillEmptyTiles with no data value?

jramm jamessramm at gmail.com
Fri May 6 04:33:36 PDT 2016

NoDataValue is set on a band level and FillEmptyTiles operates at a dataset

I've never heard of a geotiff with different nodata per band - is this even
possible, or would it be reasonable to take the nodatavalue of the 1st band
and use this to initialise the empty tiles block?

Then there is the problem of the block array being initialised as GBYte:

    GByte *pabyData = (GByte *) VSI_CALLOC_VERBOSE(nBlockBytes,1);

NoDataValue is always returned as a double, but actual data type may be
different values...Am I right in thinking TIFFTileSize will return the
number of bytes in a block for the data type of the tiff file (e.g. so block
size = nBlockBytes / sizeof(data_type)?

Would something like this be a reasonable way to initialise pabyData

int typeSize;
switch (eType){
  case GDT_Byte:
      typeSize = sizeof(GByte)
  case GDT_Int16:
      typeSize = sizeof(short)


for (int i =0; i < nBlockBytes; i+=typeSize)
    *pabyData = nullValue;

View this message in context: http://osgeo-org.1560.x6.nabble.com/Geotiff-FillEmptyTiles-with-no-data-value-tp5264310p5264905.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list