[R-sig-Geo] Rgdal and unsigned integers

Jonathan Thompson jthomps at fas.harvard.edu
Thu Aug 20 15:58:49 CEST 2009


Dear List,

I use a forest landscape model, which produces 16 bit unsigned ".gis" 
raster files. I often read and manipulate them using rgdal and the 
raster package in R.

However, sometimes, when I read in a unsigned 16 bit .gis, I get the 
following:

stnd <- raster("stand_bm.gis", values = T)

summary(stnd)
Cells:  1474962
NAs  :  0

Values             
Min.    -32140
1st Qu.      0
Median       0
Mean      8316
3rd Qu.  19180
Max.     29620


Where are these negative values coming from?   Opening the same file in 
ArcGIS confirms what I know to be true:

Pixel Type  = unsigned integer
Pixel Depth = 16 bit
Min = 0
Max = 48499

Is there anyway to force raster (or RGDAL) to treat it like an unsigned 
integer?

Thank you,
Jonathan Thompson
Harvard Forest
Harvard University
Petersham, MA 01366



More information about the R-sig-Geo mailing list