Hi Martin, you can use projectRaster in the raster package to resample from
one projection to another (and so avoid the spTransform->irregular points
thing), but otherwise I don't know how to control the rescaling without
using the GDAL command line tools (or deeper) to investigate.

If you know what the remapping is perhaps you can undo it in R with
arithmetic on the band, unsatisfactory of course.

Alternatively, try reading it with raster in the raster package, just to
see if the scaling is different.

Finally do make sure you are using the very latest rgdal (0.8-5) since
there have been recent improvements in this area.

If you can provide the file/s off-list I'd be happy to investigate.

Cheers (from Oz!), Mike.


On Wed, Mar 6, 2013 at 9:21 PM, Biuw, Martin <martin.b...@nina.no> 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.
> 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]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
>


-- 
Michael Sumner
Hobart, Australia
e-mail: mdsum...@gmail.com

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to