[Raster-commits] r442 - in pkg/raster: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 8 07:51:46 CEST 2009


Author: rhijmans
Date: 2009-05-08 07:51:46 +0200 (Fri, 08 May 2009)
New Revision: 442

Modified:
   pkg/raster/R/KML.R
   pkg/raster/R/raster.R
   pkg/raster/man/focal.Rd
   pkg/raster/man/raster.Rd
Log:


Modified: pkg/raster/R/KML.R
===================================================================
--- pkg/raster/R/KML.R	2009-05-03 02:53:35 UTC (rev 441)
+++ pkg/raster/R/KML.R	2009-05-08 05:51:46 UTC (rev 442)
@@ -48,8 +48,13 @@
 	
 	kmz <- kmlfile
 	ext(kmz) <- '.kmz'
-	com1 <- paste("7za a -tzip", kmz, kmlfile, imagefile)
-	try(	sss <- system(com1, intern=TRUE) , silent = TRUE)
+	rzipcmd <- Sys.getenv('R_ZIPCMD')
+	if (rzipcmd != "") {
+		com1 <- paste(rzipcmd, '-a', kmz, kmlfile, imagefile)
+	} else {
+		com1 <- paste("7za a -tzip", kmz, kmlfile, imagefile)
+		try(	sss <- system(com1, intern=TRUE) , silent = TRUE)
+	}
 	
 }
 

Modified: pkg/raster/R/raster.R
===================================================================
--- pkg/raster/R/raster.R	2009-05-03 02:53:35 UTC (rev 441)
+++ pkg/raster/R/raster.R	2009-05-08 05:51:46 UTC (rev 442)
@@ -28,7 +28,7 @@
 
 
 setMethod('raster', signature(x='character'), 
-	function(x, values=FALSE, band=1) {
+	function(x, values=FALSE, band=1, proj=NULL) {
 		fileext <- toupper(ext(x)) 
 		if ( fileext == ".GRD" | fileext == ".GRI" ) {
 			r <- .rasterFromRasterFile(x, band) 
@@ -38,6 +38,9 @@
 		if (values) {
 			r <- readAll(r)
 		}
+		if (!is.null(proj)) {
+			projection(r) <- proj
+		}
 		return(r)
 	}
 )

Modified: pkg/raster/man/focal.Rd
===================================================================
--- pkg/raster/man/focal.Rd	2009-05-03 02:53:35 UTC (rev 441)
+++ pkg/raster/man/focal.Rd	2009-05-08 05:51:46 UTC (rev 442)
@@ -49,9 +49,6 @@
 r[] <- runif(ncell(r)) 
 rf <- focal(r, fun=sum, ngb=3) 
 
-gf=matrix(c(1,2,3,2,1,2,3,4,3,2,3,4,5,4,3,2,3,4,3,2,1,2,3,2,1), nrow=5)/65
-rff <- focalFilter(r, filter = gf)
- 
 }
 \keyword{spatial}
 

Modified: pkg/raster/man/raster.Rd
===================================================================
--- pkg/raster/man/raster.Rd	2009-05-03 02:53:35 UTC (rev 441)
+++ pkg/raster/man/raster.Rd	2009-05-08 05:51:46 UTC (rev 442)
@@ -31,13 +31,14 @@
 
 1) Create a RasterLayer object from a file
 
-\code{raster(x, values=FALSE, band=1)}
+\code{raster(x, values=FALSE, band=1, projs=NULL)}
 
 
 \tabular{rll}{
 \tab \code{x} \tab character. name of raster file  \cr
+\tab \code{values} \tab logical. If \code{TRUE}, RasterLayer values are read into memory with \code{\link[raster]{readAll}} \cr
 \tab \code{band} \tab band number in case of a file of multiple bands, default = 1 \cr
-\tab \code{values} \tab logical. If \code{TRUE}, RasterLayer values are read into memory with \code{\link[raster]{readAll}} \cr
+\tab \code{projs} \tab Character. PROJ4 type description of a Coordinate Reference System (map projection). If NULL, the value stored on disk (if any and recognised) is used \cr
 }
 
 If \code{x} is a character value, it should be a filename of a file that the raster package can read. Supported file types are the 
@@ -56,7 +57,7 @@
  \tab \code{xmx} \tab maximum x coordinate of raster (right border) \cr
  \tab \code{ymn} \tab minimum y coordinate or raster (bottom border) \cr
  \tab \code{ymx} \tab maximum y coordinate of raster (top border) \cr
- \tab \code{projs} \tab character. PROJ4 type description of a map projection \cr
+ \tab \code{projs} \tab Character. PROJ4 type description of a Coordinate Reference System (map projection) \cr
  \tab \code{bndbox} \tab bounding box used to crop a raster. Any object that is a BoundingBox object or contains one (such as Raster* objects) \cr
 }
 



More information about the Raster-commits mailing list