Hi Emma,
In writeRaster(), the argument is "datatype", not
"dataType".
Hope this helps,
Pascal
On Fri, Sep 26, 2014 at 3:08 AM, White, Emma <emma.white at sdstate.edu>
wrote:> Hi,
>
> I am reading in some raster files and converting them to GeoTiff (using the
> raster package), I want them to be 8 bit unsigned integer (values in the
> case of this particular raster range from 0 to 55). However when writing
the
> raster to GeoTiff R seems to assign it to dataType "FLT4S"
despite
> specifying the dataType. See example code below:
>
> foo<- raster(raster.files[1],datatype = INT1U)
> dataType(foo)
> [1] "INT1U"
> fool<-
writeRaster(foo,filename=paste("../test/",raster.files[1],sep=""),
> format="GTiff",dataType = 'INT1U',overwrite=TRUE)
> dataType(fool)
> [1] "FLT4S"
>
> Any help/ insight would be appreciated. Thanks!
>
>
> Emma
>
> --
> Emma White
> PhD Candidate
> Geospatial Science Center of Excellence
> South Dakota State University
> Email: Emma.White at sdstate.edu
> Web:
http://globalmonitoring.sdstate.edu/people.php?view=3&a=show&id=86
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan