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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 22 16:49:08 CEST 2009


Author: rhijmans
Date: 2009-04-22 16:49:08 +0200 (Wed, 22 Apr 2009)
New Revision: 425

Modified:
   pkg/raster/R/contour.R
Log:


Modified: pkg/raster/R/contour.R
===================================================================
--- pkg/raster/R/contour.R	2009-04-22 14:04:00 UTC (rev 424)
+++ pkg/raster/R/contour.R	2009-04-22 14:49:08 UTC (rev 425)
@@ -6,10 +6,14 @@
 
 
 setMethod("contour", signature(x='RasterLayer'), 
-	function(x, ...)  {
+	function(x, maxdim=1000, add=TRUE, ...)  {
 		if (dataContent(x) != 'all') { 
 #	to do: should  test if can read, else sample
-			x <- readAll(x) 
+			if (canProcessInMemory(x, 2)) {
+				x <- readAll(x) 
+			} else {
+				x <- sampleSkip(x, maxdim, asRaster=TRUE)
+			}
 		}
 		contour(x=xFromCol(x,1:ncol(x)), y=yFromRow(x, nrow(x):1), z=t((values(x, format='matrix'))[nrow(x):1,]), ...)
 	}



More information about the Raster-commits mailing list