Re: [R-sig-Geo] writeRaster to TIF changes raster maximum value

2013-09-17 Thread Guillaume Drolet
.. There are definitely some behaviour I don't quite get in all this... Thanks, Guillaume 2013/9/17 : > > > > -------- Message original ---- > Sujet: Re: [R-sig-Geo] writeRaster to TIF changes raster maximum value > Date : Tue, 17 Sep 2013 01:25:53 -0400 > De :

Re: [R-sig-Geo] writeRaster to TIF changes raster maximum value

2013-09-16 Thread Robert J. Hijmans
Guillaume, This indeed happens because of NA value handling problems. The native raster format uses 255 as the NA value for Byte files. That probably needs to change. You write such a file because you crop a large area and a temporary file is written. There are work arounds, see below, but i will

Re: [R-sig-Geo] writeRaster to TIF changes raster maximum value

2013-09-16 Thread Guillaume.Drolet
Dear Robert, Here's a link to 2 images: the original raster (full) and the cropped one (sub): https://www.dropbox.com/sh/8zo8fo964kr6ttk/pH1JIpTZ1C The original raster has Byte values, as you suspected. But I don't know how to handle that so that it's not used as NA value. From what I read, NA

Re: [R-sig-Geo] writeRaster to TIF changes raster maximum value

2013-09-16 Thread Robert J. Hijmans
I suspect that the original file has Byte values and that 255 is used, perhaps erroneously, as NA. Can you give me access to the file? Thanks, Robert On Mon, Sep 16, 2013 at 8:10 AM, wrote: > Dear list members, > > I need your help trying to figure out why my raster's maximum value gets > change

[R-sig-Geo] writeRaster to TIF changes raster maximum value

2013-09-16 Thread Guillaume.Drolet
Dear list members, I need your help trying to figure out why my raster's maximum value gets changed in the resulting TIF file from a call to the writeRaster function. I read here (http://r-sig-geo.2731867.n2.nabble.com/writeRaster-to-ascii-file-asc-td7584093.html#none) that this problem could