[Gdal-dev] ESRI flt nbits issue

Markus Neteler neteler at itc.it
Fri Jan 20 11:58:24 EST 2006


On Fri, Jan 20, 2006 at 05:19:50PM +0100, Markus Neteler wrote:
> On Fri, Jan 20, 2006 at 08:34:15AM -0500, Frank Warmerdam wrote:
> > On 1/20/06, Markus Neteler <neteler at itc.it> wrote:
> > > Hi,
> > >
> > > I was trying to use an ESRI .flt file:
> > >
> > > gdalinfo edenglcc2kfor.flt
> > > ERROR 6: EHdr driver does not support 1541835190 NBITS value.
> > > GDALOpen failed - 6
> > > EHdr driver does not support 1541835190 NBITS value.
> > >
> > > It seems that 'nbits' is not initialized if missing
> > > in the header file:
> > >
> > > ncols         10018
> > > nrows         8200
> > > xllcorner     -20
> > > yllcorner     6.17
> > > cellsize      0.008333
> > > NODATA_value  -9999
> > > byteorder     LSBFIRST
> > >
> > > -rw-rw-rw-  1 neteler ssi        69 Oct 13 16:08 edenglcc2kfor.prj
> > > -rw-rw-rw-  1 neteler ssi 328590400 Oct 13 16:08 edenglcc2kfor.flt
> > > -rw-rw-rw-  1 neteler ssi      3598 Oct 14 12:51 edenglcc2kfor.xml
> > > -rw-rw-rw-  1 neteler ssi       167 Jan 20 10:47 edenglcc2kfor.hdr
> > >
> > > Maybe the driver could be enabled to guess the nbits size if
> > > missing inte the .hdr file?
> > 
> > Markus,
> > 
> > I have modified the code to default to nbits=8 if not specified,
> > but that won't make this file work.  You will still need to add
> > "NBITS 32" to the .hdr file.
> 
> Thanks, Frank.
> 
> Suggestion:
> Couldn't the driver simply calculate nbits from the file size?
> 
> ncols         10018
> nrows         8200
> > 10018 * 8200
> [1] 82147600
> 
> and
>  -rw-rw-rw-  1 neteler ssi 328590400 Oct 13 16:08 edenglcc2kfor.flt
> 
> > 328590400 / 82147600
> [1] 4
> 
> So I assume nbits=4 here.

To reduce confusion, it's actually 32bit here (I tested all).
So my suggestion above will not work like that.
 
> I have received a number of files where the 'nbits' row is missing.

The ESRI white paper suggests 8 bit per default, so we can consider
this issue as solved.

Markus 



More information about the Gdal-dev mailing list