[GRASS-user] Importing ESRI .hdr Labelled raster via r.in.gdal displays strange aliasing pattern

Patton, Eric epatton at nrcan.gc.ca
Fri May 11 13:35:28 EDT 2007

I'm importing an Arc Floating-point raster using the 'EHdr/ESRI .hdr Labelled' driver in gdal:

$ gdalinfo 45_04_N_66_44_W_BATHY.flt

Driver: EHdr/ESRI .hdr Labelled
Size is 2641, 3721
Coordinate System is `'
Origin = (2481609.500000000000000,7340725.500000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Corner Coordinates:
Upper Left  ( 2481609.500, 7340725.500) 
Lower Left  ( 2481609.500, 7337004.500) 
Upper Right ( 2484250.500, 7340725.500) 
Lower Right ( 2484250.500, 7337004.500) 
Center      ( 2482930.000, 7338865.000) 
Band 1 Block=2641x1 Type=Byte, ColorInterp=Undefined
  NoData Value=-99999.999

The projection is New Brunswick Double Stereographic (EPSG #2953). I have set up a Location with these projection parameters.
Th import seems to progress fine with no errors, but the imported raster doesn't display any data, just a jagged, greyscale grid. (A screenshot of the imported raster was too big to attach, but I can provide it in a separate email attachment if anyone is interested.)  

I suspect, but am not sure, that I need to use gdal_translate instead and pass some CREATOPT parameters? 

Also noteworthy is the fact that I had to do a tiny hack to the hdr file as per Frank Warmerdam's suggestion through the GDAL bugtracker:
(Background: I was received a malloc error when trying to import the ESRI Floating-point raster. See http://trac.osgeo.org/gdal/ticket/1573)

>From Frank Warmerdam:

"The problem is related to initialization when the NBITS keyword is missing
from the .hdr file.  In 1.4.0 a bunch of new code was introduced for NBITS
< 8, but it also added a dependency on having the keyword present.

The workaround is to add "NBITS 8" in the .hdr file.

Fix is to default to 8 in the code.  The fix has been committed in trunk,
and 1.4 branch and it should be released in 1.4.2."

I have added the above fix to the hdr file prior to using r.in.gdal to import the raster.

Any help appreciated!

~ Eric.

More information about the grass-user mailing list