[R-sig-Geo] readGDAL re-mapping data to 0-255

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 6 12:47:23 CET 2013


On Wed, 6 Mar 2013, Biuw, Martin wrote:

> Hi,
> I'm using readGDAL to read data from a geoTiff file. The valid data 
> range of the single band is -26 to 0. I have two versions of the file, 
> one with a NoDataValue = -9999 and one with NoDataValue = -128. When 
> reading the version with -9999 everything works great, and I get the 
> data values in band1 mapped correctly on the original interval. But when 
> I use the version of the file with NoDataValue = -128, these band1 data 
> values get re-mapped to 0-255.

This appears to indicate that the files do not only differ in NoDataValue, 
but also in storage form. Does examining the output of GDALinfo() on both 
tell you anything? Is one a signed 16-bit integer, the other Byte? Maybe 
paste some of the output into a follow-up?

Roger

> I remember reading a helpfile or R-sig 
> post on why the NoDataValue has such an effect, or what can be done to 
> get around it. But can't for the life of me find that message anymore. 
> The reason I need to use the file with NoDataValue = -128 is that this 
> is in UTM 35 while the other one is in UTM 33. Since it's a 
> SpatialGridDataFrames, I'd rather not use spTransform on it, since this 
> turns it into a SpatialPointsDataFrame. The files were originally 
> created (by someone else) in ArcGIS, so I could always ask them to 
> re-create them with correct NoDataValue. But maybe there's a way to 
> explicitly tell readGDAL how to treat the data values? I've desperately 
> been looking for any help on this, but must be looking in the wrong 
> place....
> Thanks in advance,
> Martin
>
> ________________________________________________________________
> Martin Biuw (PhD)
> Researcher
>
> Norwegian Institute for Nature Research - NINA
> Postal address: Framsenteret, 9296 Troms?, NORWAY
> Delivery/Visiting address: Framsenteret, Hjalmar Johansens gate 14, 9007 Troms?, NORWAY
> Phone: +47 77 75 04 17 * Cell: +47 40 72 96 15 * Fax: +47 77 75 04 01 * www.nina.no<http://www.nina.no/>
> ________________________________________________________________
>
>
> 	[[alternative HTML version deleted]]
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list