[Gdal-dev] Import WorldClim data byte issue

Markus Neteler neteler at itc.it
Thu Oct 26 04:25:28 EDT 2006


Frank Warmerdam wrote:
> > Markus Neteler <neteler at itc.it> wrote:
> > >hi,
> > >
> > >we tried to import the worldclim tile data (generic format BIL)
> > >from
> > >http://www.worldclim.org/tiles.php
> > >
> > >Unfortunately the result ranges from 0-65535.
> > >The page http://www.worldclim.org/format.htm describes
> > >"The data files (.BIL) are sequential binary files in which
> > > values are stored line by line from the upper-left to the
> > > lower-right corner. Each cell (pixel) is an integer value
> > > (2 bytes; -32768..32767).
> > >"
> > >
> > >Do I need postprocessing (such as r.mapcalc in GRASS) to
> > >read these maps or is there another nice trick?
> > >
> > >thanks
> > >markus
>
>
> Markus,
> 
> The EHDR (ESRI .HDR labelled BIL) driver now supports a keyword in
> the file called PIXELTYPE which can have values like SIGNEDINT,
> UNSIGNEDINT or FLOATINGPOINT.  So just add a line like the following in
> the .hdr file.
> 
> PIXELTYPE SIGNEDINT
> 
> Future versions of ArcGIS, and possibly 9.2 should also honour this
> keyword.  The capability was included in GDAL 1.3.2.

Frank,

great, this works!

# being lazy (apparently the PIXELTYPE can appear anywhere in .hdr):
  echo "PIXELTYPE SIGNEDINT" >> tmean4_16.hdr
  gdalinfo -mm tmean4_16.bil
  ...
  Band 1 Block=3600x1 Type=Int16, ColorInterp=Undefined
      Computed Min/Max=-154.000,228.000
    NoData Value=-9999

# ... looks ok (temperatures are multiplied by 10)


# GRASS Import:
r.in.gdal tmean4_16.bil out=tmean4_16 -o
# ... now successful.

thanks,
Markus




More information about the Gdal-dev mailing list