[R-sig-Geo] writeRaster error: unknown file format

pecardoso pauloeducardoso at gmail.com
Fri Jan 24 12:27:11 CET 2014


I'm getting an error with writeRaster with apparent no particular reason.

The procedure I'm following:

*1. *reading an original landsat OLI band (TIF) downloaded from
http://earthexplorer.usgs.gov/

band <- raster(file.path(dir.work, 'LC81810682013122LGN01_B2.tif'), package
= "raster")

band
class       : RasterLayer 
dimensions  : 7311, 7521, 54986031  (nrow, ncol, ncell)
resolution  : 30, 30  (x, y)
extent      : 370485, 596115, -1388715, -1169385  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=33 +datum=WGS84 +units=m +no_defs +ellps=WGS84
+towgs84=0,0,0 
data source :
D:\Dropbox\Kumbira2010\Landsat\LC81810682013122LGN01\LC81810682013122LGN01_B2.tif 
names       : LC81810682013122LGN01_B2 
values      : 0, 65535  (min, max)

*2. *crop band to a given extent 
myext <- extent(c(416985, 425295, -1241505, -1226985))
cropb <- crop(band, myext)
dataType(cropb)
[1] "INT2U # just like the original

*3. *Write IDRISI raster file
writeRaster(band2.ae, filename = file.path(tempdir(),'cropb.rst'), format =
'IDRISI', overwrite = TRUE)

Error in .setFileExtensionHeader(filename, filetype) : 
  unknown file format

Running from RStudio Version 0.98.490 
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

I get the same behaviour with raster 2.2-5 package 
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-14  raster_2.2-12 sp_1.0-14    

loaded via a namespace (and not attached):
[1] grid_3.0.2      lattice_0.20-24 tools_3.0.2 




--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/writeRaster-error-unknown-file-format-tp7585627.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list