[R-sig-Geo] Read raster data in Big Endian (Motorola) byteorder on Little Endian (Intel) system
O'Hanlon, Simon J
simon.ohanlon at imperial.ac.uk
Tue Jul 17 18:46:56 CEST 2012
Dear all,
I am working with some raster data (.bil format), with values stored in big endian byteorder. The info in the associated .hdr file is:
BYTEORDER M
LAYOUT BIL
NROWS 9194
NCOLS 8736
NBANDS 1
NBITS 16
BANDROWBYTES 17472
TOTALROWBYTES 17472
BANDGAPBYTES 0
When I read in 'mydata' using raster I see that it correctly states the min (-9999) and max (2376) values of the data (I assume from the .stx file since I believe the values are not actually read to memory at this stage?). However when I do str(mydata) I see that @file at byteorder slot is "little" and if I try:
values <- getValues(mydata)
min(values)
2
max(values)
55537
And most weirdly if I do:
summary(values)
Min. 1st Qu. Median Mean 3rd Qu. Max.
2 757 55540 35030 55540 55540
Does anyone know if/how I can specify the byteorder as Big Endian to the rgdal driver/raster function? I have tried changing BYTEORDER in the .hdr file to "big", but it does not work.
Thanks,
Simon
More information about the R-sig-Geo
mailing list