[R-sig-Geo] Rgdal and unsigned integers
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Thu Aug 20 18:48:31 CEST 2009
On Thu, Aug 20, 2009 at 2:58 PM, Jonathan
Thompson<jthomps at fas.harvard.edu> wrote:
> 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?
What are these .gis files? What driver is rgdal using to read them?
For example:
> foo = readGDAL("./Random.png")
./Random.png has GDAL driver PNG
and has 30 rows and 20 columns
> foo = readGDAL("./random.gtiff")
./random.gtiff has GDAL driver GTiff
and has 25 rows and 30 columns
My rgdal doesn't mention .gis files in its list of drivers that I get
with gdalDrivers()...
The GDALinfo("foo.png") function might give us some useful info too...
Barry
More information about the R-sig-Geo
mailing list