[Raster-commits] r293 - pkg/raster/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Feb 22 14:53:46 CET 2009
Author: rhijmans
Date: 2009-02-22 14:53:45 +0100 (Sun, 22 Feb 2009)
New Revision: 293
Modified:
pkg/raster/R/writeGDAL.R
Log:
Modified: pkg/raster/R/writeGDAL.R
===================================================================
--- pkg/raster/R/writeGDAL.R 2009-02-22 13:28:17 UTC (rev 292)
+++ pkg/raster/R/writeGDAL.R 2009-02-22 13:53:45 UTC (rev 293)
@@ -16,7 +16,7 @@
# this needs to get fancier; depending on object and the abilties of the drivers
.getGdalDType <- function(dtype) {
- if (!(dtype %in% c('LOGICAL', 'INT1S', 'INT2S', 'INT4S', 'INT8S', 'INT1U', 'INT2U', 'INT4U', 'INT8U', 'FLT4S', 'FLT8S'))) {
+ if (!(dtype %in% c('LOG1S', 'INT1S', 'INT2S', 'INT4S', 'INT8S', 'INT1U', 'INT2U', 'INT4U', 'INT8U', 'FLT4S', 'FLT8S'))) {
stop('not a valid data type')
}
type <- substr(dtype,1,3)
@@ -65,7 +65,7 @@
#.GDALDataTypes <- c('Unknown', 'Byte', 'UInt16', 'Int16', 'UInt32','Int32', 'Float32', 'Float64', 'CInt16', 'CInt32', 'CFloat32', 'CFloat64')
# this needs to get fancier; depending on object and the abilties of the drivers
- dataformat <- .getGdalDType(dtype <- raster at file@datanotation)
+ dataformat <- .getGdalDType(raster at file@datanotation)
driver = new("GDALDriver", gdalfiletype)
@@ -92,6 +92,7 @@
attr(raster, "transient") <- transient
raster at file@driver <- 'gdal'
raster at file@gdalhandle <- list()
+ raster at data@source <- 'disk'
}
for (band in 1:nlayers(raster)) {
x <- putRasterData(raster at transient, values(raster, rownr), band, c((rownr-1), 0))
@@ -100,12 +101,11 @@
saveDataset(raster at transient, filename(raster) )
GDAL.close(raster at transient)
rasterout <- rasterFromFile(filename(raster))
-
- rasterout at data@source <- 'disk'
rasterout at data@haveminmax <- raster at data@haveminmax
rasterout at data@min <- raster at data@min
rasterout at data@max <- raster at data@max
.writeStx(rasterout)
+ return(rasterout)
}
return(raster)
}
More information about the Raster-commits
mailing list