[Gdal-dev] Byte swapping BIL data?

Schuyler Erle schuyler at nocat.net
Sat Dec 4 13:35:48 EST 2004


* On  4-Dec-2004 at 10:17AM PST, To gdal-dev at xserve.flids.com said:
> I have a BIL file of population data from the Gridded Population of
> the World project. GDAL can read the extents of the file, but not the
> Float32 data values inside it. I can import the file into GRASS using
> r.in.bin, but I have to use the -b switch to do byte swapping to get
> the right values out. From this I infer that the dataset has the wrong
> endianness, but is otherwise intact.

Ok, note to self: RTFS before asking dumb questions on mailing list.

So the .hdr file contains the line "BYTEORDER M". If I run gdalinfo
-mm on the unmodified BIL file, I get min/max values of 0 and 0, which
is clearly not right. (They import into GRASS in the range 0 to
621000, which actually seems correct.)

If I change this to "BYTEORDER L" and run gdalinfo -mm, I get absurdly
large/small nonsense values back (e.g. -1e40), instead of 0, but this
doesn't seem like an improvement in my affairs.

Anyone got any other ideas?

SDE



More information about the Gdal-dev mailing list