[Gdal-dev] esri .hdr open problem; minor hdf4 channels issue

Vladimir Slepnev slepnev_v at newmail.ru
Fri Sep 26 02:41:59 EDT 2003


Well, here's an ESRI header file for a dataset that is giving us
problems; when reading through GDAL, all channels appear identical to
the first one. Could it be because BANDGAPBYTES==0?

Also, HDF4 datasets with 3D SDS sometimes open blatantly wrong: e.g. a
6000x3x6000 SDS opened as 6000 bands, each of size 3x6000. This one
seems to be pretty easy to correct, here are the changes we've made to
hdf4dataset.cpp:

/* --------------------------------------------------------------------
*/
/*      Select SDS or GR for reading from.
*/
/* --------------------------------------------------------------------
*/ ... 
// Create band information objects. 
switch( poDS->iRank ) { case 2:
  poDS->nBands = 1;
  poDS->iXDim = 1;
  poDS->iYDim = 0;
  break;

case 3:
// BIP
if((poDS->aiDimSizes[0] < poDS->aiDimSizes[1]) &&
   (poDS->aiDimSizes[0] < poDS->aiDimSizes[2]) )
{
  poDS->iBandDim = 0;
  poDS->iYDim    = 1;
  poDS->iXDim    = 2;
}
else
{
  // BIL
  if((poDS->aiDimSizes[1] <= poDS->aiDimSizes[0]) &&
     (poDS->aiDimSizes[1] <= poDS->aiDimSizes[2]) )
  {
    poDS->iYDim    = 0;
    poDS->iBandDim = 1;
    poDS->iXDim    = 2;
  }
  else
  { // BSQ
    poDS->iYDim    = 0;
    poDS->iXDim    = 1;
    poDS->iBandDim = 2;

  }
}

Vladimir Slepnev
Programmer, RDC ScanEx
-------------- next part --------------
NROWS          166
NCOLS          166
NBANDS         3
NBITS          8
BYTEORDER      I
LAYOUT         BIL
SKIPBYTES      0
ULXMAP         0.000
ULYMAP         0.000
XDIM           1.000
YDIM           1.000
BANDROWBYTES   166
TOTALROWBYTES  498
BANDGAPBYTES   0


More information about the Gdal-dev mailing list