[Raster-commits] r262 - pkg/raster/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 8 10:06:40 CET 2009


Author: rhijmans
Date: 2009-02-08 10:06:40 +0100 (Sun, 08 Feb 2009)
New Revision: 262

Modified:
   pkg/raster/R/export.R
   pkg/raster/R/polygonToRaster.R
   pkg/raster/R/writeGDAL.R
Log:


Modified: pkg/raster/R/export.R
===================================================================
--- pkg/raster/R/export.R	2009-02-08 08:16:14 UTC (rev 261)
+++ pkg/raster/R/export.R	2009-02-08 09:06:40 UTC (rev 262)
@@ -12,10 +12,20 @@
 	} else {
 		stop("This format is not supported")
 	}
+	.writeStx(raster)
  }
  
  
+.writeStx <- function(raster) {
+	if (raster at data@haveminmax) {
+		stxfile <- setFileExtension(filename(raster), ".stx")
+		thefile <- file(stxfile, "w")  # open an txt file connectionis
+		cat(1, " ", minValue(raster), " ", maxValue(raster), "\n", file = thefile)
+		close(thefile)
+	}	
+}
  
+ 
 .writeBilHdr <- function(raster) {
 	hdrfile <- setFileExtension(filename(raster), ".hdr")
 	thefile <- file(hdrfile, "w")  # open an txt file connectionis

Modified: pkg/raster/R/polygonToRaster.R
===================================================================
--- pkg/raster/R/polygonToRaster.R	2009-02-08 08:16:14 UTC (rev 261)
+++ pkg/raster/R/polygonToRaster.R	2009-02-08 09:06:40 UTC (rev 262)
@@ -153,7 +153,7 @@
 						} else {
 							rv[over] <- subpol[i,4] 
 						}
-						print(paste('single node detected on row:', r))
+						print(paste('exit node intersection on row:', r))
 					} else {
 						for (k in 1:round(nrow(intersection)/2)) {
 							l <- (k * 2) - 1		

Modified: pkg/raster/R/writeGDAL.R
===================================================================
--- pkg/raster/R/writeGDAL.R	2009-02-08 08:16:14 UTC (rev 261)
+++ pkg/raster/R/writeGDAL.R	2009-02-08 09:06:40 UTC (rev 262)
@@ -77,7 +77,7 @@
 		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(raster)
 }
@@ -101,6 +101,8 @@
 #       }
 	saveDataset(transient, filename(raster) )
 	GDAL.close(transient) 
+	.writeStx(raster) 
+
 	tempras <- rasterFromFile(filename(raster) )
 	raster at file@gdalhandle <- tempras at file@gdalhandle
 	return(raster)



More information about the Raster-commits mailing list