[R-sig-Geo] writeRaster and Landsat 8 OLI 16bit unsigned data

pecardoso pauloeducardoso at gmail.com
Wed Aug 14 18:58:00 CEST 2013


I'm not being able to export Landsat8 (16bit: 0-65535) TIF to IDRISI .RST
files with writeRaster().

IDRISI (Taiga) fail to read .RST files resulting from writeRaster().

First thing, which may be a typing error from raster help, is that from
?dataType one can read that INT2U range is 0-65534 and "For all integer
types, except the single byte types, the lowest (signed) or highest
(unsigned) value is used to store NA".

Curiously for INT1U the range interval presented is ok (0-255).

Why INT2U range is not 0-65535?

I'm not sure if this is preventing writeRaster to assign the entire Landsat
range of values  (0-65535).

In the conversion process I'm getting the right dataType() for memory-stored
raster file: INT2U.

I'm then cropping each band to some extent and exporting it to RST with:

writeRaster(img.crop, filename = paste0(dir.rst, fname,'.rst'),
                format = 'IDRISI', overwrite = TRUE,
                datatype='INT2U',
                crs = proj.i, NAflag = 0)

Please let me know if I should add any further explanation.

Landsat 8 can be downloaded for free from http://earthexplorer.usgs.gov/ or
http://glovis.usgs.gov/

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Portuguese_Portugal.1252  LC_CTYPE=Portuguese_Portugal.1252   
[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C                        
[5] LC_TIME=Portuguese_Portugal.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgdal_0.8-10  raster_2.1-49 sp_1.0-11    

loaded via a namespace (and not attached):
[1] grid_3.0.1      lattice_0.20-15 tools_3.0.1 
Further detail about data: http://landsat.usgs.gov/tools_faq.php

Any help or comment will be appreciated.



--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-and-Landsat-8-OLI-16bit-unsigned-data-tp7584417.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list