[R] rgdal package: save multiband image in tiff file

Niceman_64 brice.mora at nrcan.gc.ca
Mon Apr 12 19:47:18 CEST 2010


Hello all,

I am trying to save a multiband matrix in a tiff file with writeGDAL() from
the rgdal package.
The code below only saves the first band of the matrix StockMat.
Do you have any suggestion to correct my code?

Thanks a lot.

nbRow=nrow(StockMat)
nbCol=ncol(StockMat)
StockMat_GridTopo=GridTopology(cellcentre.offset = c(nbRow, nbCol,
ncol(Data)),cellsize = c(1, 1, 1), cells.dim = dim(StockMat))
StockMat_SGDF=SpatialGridDataFrame(StockMat_GridTopo, data.frame(depth =
as.vector(StockMat)))
writeGDAL(StockMat_SGDF, fname="T:/Masses_QB.tiff", drivername = "GTiff",
type = "Float32", mvFlag = NA)

-- 
View this message in context: http://n4.nabble.com/rgdal-package-save-multiband-image-in-tiff-file-tp1837476p1837476.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list