[Gdal-dev] negative nodata value loaded as positive in gdal 1.4.0

Maciej Sieczka tutey at o2.pl
Sat Jan 27 12:17:36 EST 2007


Hernán De Angelis wrote:

> Today I tried a large number of SRTM tiles, including 1" and 3" as well as  
> versions 1 and 2 and the problem is still present, so I also came to the 
> conclusion that it is likely a bug in GDAL. I hope some one else can comfirm 
> this.

Hi,

I think I have found the reason and solution.

GDAL requires explicitely set "PIXELTYPE SIGNEDINT" in the hdr file to
treat the EHdr as a singed integer.

r.in.srtm follows the guideline at [1] which doesn't mention this keyword.

After adding the "PIXELTYPE SIGNEDINT" into the hdr created by
r.in.srtm GDAL recognizes the value range properly. See:

without "PIXELTYPE SIGNEDINT" - bad:

$ gdalinfo tmp/srtm_v1_N51E016/N51E016.hgt -mm
Driver: EHdr/ESRI .hdr Labelled

<snip>

Band 1 Block=1201x1 Type=UInt16, ColorInterp=Undefined
    Computed Min/Max=37.000,32768.000
  NoData Value=-32768



with "PIXELTYPE SIGNEDINT" - good:

gdalinfo tmp/srtm_v1_N51E016/N51E016.hgt -mm
Driver: EHdr/ESRI .hdr Labelled

<snip>

Band 1 Block=1201x1 Type=Int16, ColorInterp=Undefined
    Computed Min/Max=37.000,484.000
  NoData Value=-32768


Markus,

Should I apply this fix?

Frank,

GDAL-created hdr files don't include the BANDGAPBYTES parameter
mentioned in [1]. Is that OK?

Maciek

[1]
ftp://e0srp01u.ecs.nasa.gov/srtm/version1/Documentation/Notes_for_ARCInfo_users.txt



More information about the Gdal-dev mailing list