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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Feb 7 07:52:06 CET 2009


Author: rhijmans
Date: 2009-02-07 07:52:06 +0100 (Sat, 07 Feb 2009)
New Revision: 252

Added:
   pkg/raster/man/aggregate-methods.Rd
   pkg/raster/man/merge-methods.Rd
   pkg/raster/man/overlay-methods.Rd
   pkg/raster/man/raster.Rd
   pkg/raster/man/rasterFromFile.Rd
   pkg/raster/man/writeadvanced.Rd
Removed:
   pkg/raster/man/aggregate.Rd
   pkg/raster/man/create.raster.Rd
   pkg/raster/man/merge.Rd
   pkg/raster/man/overlay.Rd
   pkg/raster/man/rasterdistance.Rd
Modified:
   pkg/raster/DESCRIPTION
   pkg/raster/NAMESPACE
   pkg/raster/R/Overlay.R
   pkg/raster/R/properties.R
   pkg/raster/man/PolygonsToRaster.Rd
   pkg/raster/man/write.Rd
Log:


Modified: pkg/raster/DESCRIPTION
===================================================================
--- pkg/raster/DESCRIPTION	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/DESCRIPTION	2009-02-07 06:52:06 UTC (rev 252)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Raster data handling for geographic data analysis and modeling
 Version: 0.8.8-0
-Date: 6-Feb-2009
+Date: 7-Feb-2009
 Depends: methods, sp, rgdal (>= 0.5-33), R (>= 2.8.0)
 Author: Robert J. Hijmans & Jacob van Etten
 Maintainer: Robert J. Hijmans <r.hijmans at gmail.com> 

Modified: pkg/raster/NAMESPACE
===================================================================
--- pkg/raster/NAMESPACE	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/NAMESPACE	2009-02-07 06:52:06 UTC (rev 252)
@@ -2,7 +2,7 @@
 importFrom("graphics", hist, plot)
 importFrom("stats", median, aggregate)
 importFrom("utils", stack)
-importFrom("sp", bbox, overlay, Spatial, SpatialPixels, SpatialPixelsDataFrame, SpatialGrid, SpatialGridDataFrame)
+importFrom("sp", overlay, bbox, Spatial, SpatialPixels, SpatialPixelsDataFrame, SpatialGrid, SpatialGridDataFrame)
 exportClasses(BoundingBox, BasicRaster, Raster, RasterLayer, RasterStack)
-exportMethods(aggregate, stack, median, show, summary, plot, hist, ncol, nrow, dim, overlay, bbox)
+exportMethods(overlay, bbox, aggregate, stack, median, show, summary, plot, hist, ncol, nrow, dim)
 exportPattern("^[^\\.]")
\ No newline at end of file

Modified: pkg/raster/R/Overlay.R
===================================================================
--- pkg/raster/R/Overlay.R	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/R/Overlay.R	2009-02-07 06:52:06 UTC (rev 252)
@@ -1,17 +1,11 @@
 # Author: Robert J. Hijmans, r.hijmans at gmail.com
 # International Rice Research Institute
 # Date :  June 2008
-# Version 0,1
+# Version 0.8
 # Licence GPL v3
 
 
 
-if (!isGeneric("overlay")) {
-	setGeneric("overlay", function(x, y, ..., fun, filename, overwrite, asInt)
-		standardGeneric("overlay"))
-}	
-
-
 setMethod('overlay', signature(x='RasterLayer', y='RasterLayer'), 
 function(x, y, ..., fun=sum, filename="", overwrite=FALSE, asInt = FALSE){ 
 
@@ -31,19 +25,9 @@
 		}
 	}
 	
-	f <- formals(fun)
-	if (length(f) != length(rasters)) {
-		stop(paste("Function/data mismatch. You provided a function with", length(f), "arguments. While passing", length(rasters), "RasterLayer objects."))
-	}
+	compare(c(x, rasters))
 
-	
-	for (i in 2:length(rasters)) {
-		if (!compare(c(x, rasters[i]))) { 
-			stop('Extent and/or resolution of rasters do not match') 
-		}	
-	}
-	outraster <- setRaster(x)
-	outraster <- setFilename(outraster, filename)
+	outraster <- setRaster(x, filename)
 	if (asInt) { outraster <- setDatatype(outraster, 'integer') }
 
 	inram <- TRUE
@@ -51,9 +35,7 @@
 		if (dataContent(rasters[[i]]) != 'all') {inram <- FALSE} 
 	}	
 	
-	
 	if ( inram ) {
-		
 		vallist <- list()
 		for (i in 1:length(rasters)) {
 			vallist[[i]] <- values(rasters[[i]])
@@ -83,10 +65,9 @@
 				}	
 			}	
 			
-			
 			for (i in 1:length(rasters)) {
 				vallist[[i]] <- values(rasters[[i]])
-				clearValues(rasters[[i]])
+			#	clearValues(rasters[[i]])
 			}
 			vals <- do.call(fun, vallist)
 			
@@ -107,3 +88,4 @@
 	return(outraster)
 }
 )
+

Modified: pkg/raster/R/properties.R
===================================================================
--- pkg/raster/R/properties.R	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/R/properties.R	2009-02-07 06:52:06 UTC (rev 252)
@@ -74,11 +74,6 @@
 	return(object at file@name)
 }
 
-ncells <- function(object) {
-	warning("'ncells' is obsolete. Use 'ncell' instead")
-	return(return( as.numeric(nrow(object)) * ncol(object )))
-}
-
 ncell <- function(object) {
 # return numeric to avoid integer overflow
 	return(return( as.numeric(nrow(object)) * ncol(object )))

Modified: pkg/raster/man/PolygonsToRaster.Rd
===================================================================
--- pkg/raster/man/PolygonsToRaster.Rd	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/man/PolygonsToRaster.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -8,7 +8,7 @@
 Two algorithms for polygon to raster conversion. The polygons are rasterized. Either values associated with each polygon, or a polygon ID are transferred. Holes in polygons are recognized by polygonsToRaster, but not by polygonsToRaster2.
 }
 \usage{
-polygonsToRaster(spPolys, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA") 
+polygonsToRaster(spPolys, raster, field=0, filename="", overwrite=FALSE, updateRaster=FALSE, updateValue="NA", trackRows=0) 
 polygonsToRaster2(spPolys, raster, field=0, filename="", overwrite=FALSE) 
 }
 
@@ -20,6 +20,7 @@
   \item{overwrite}{ logical. if \code{TRUE} ouput file will be overwritten if it exists }
   \item{updateRaster}{logical. If \code{TRUE} the values of the input RasterLayer are updated where the polygons overlap cells  }
   \item{updateValue}{character. Select cells to be updated (if \code{updateRaster == TRUE}) by their current values. Either 'all', 'NA', '!NA', or 'zero' } 
+  \item{trackRows}{vector of row numbers for which the function will report that they have been processed. To track progress on very large files }
 }
 
 \details{

Added: pkg/raster/man/aggregate-methods.Rd
===================================================================
--- pkg/raster/man/aggregate-methods.Rd	                        (rev 0)
+++ pkg/raster/man/aggregate-methods.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -0,0 +1,49 @@
+\name{aggregate}
+\docType{methods}
+\alias{aggregate}
+\alias{aggregate,RasterLayer-method}
+\title{ Aggregate a RasterLayer }
+
+\description{Aggregate a RasterLayer to create a new raster with a lower resolution. 
+  \code{aggregate} is a generic function described in the package `stats'.}
+}
+\section{Methods}{
+\describe{
+\code{aggregate(x, fact = 2, fun = mean, expand = TRUE, rm.NA = TRUE, filename="", overwrite=FALSE, asInt = FALSE) }
+
+
+\item{x}{ a RasterLayer object}
+\item{filename}{output filename for a new raster}
+  \item{fun}{function used to aggregate values. It should return one number. E.g. mean or max}
+  \item{fact}{degree of aggregation or disaggregation expressed as number of cells (horizontally and vertically). See details}
+  \item{expand}{if \code{expand == TRUE} grids will get larger if \code{factor} if the number of the division of the columns or rows with factor does not return an integer}
+  \item{rm.NA}{if \code{rm.NA == TRUE}, remove NA cells from calculations}
+  \item{asInt}{logical. If \code{TRUE} the values will be rounded and stored as integer}
+  \item{overwrite}{if TRUE, "filename" will be overwritten if it exists}
+}
+}
+
+\details{
+ In aggregation \code{fact = 2} will result in a grid with 2 x 2 = 4 times fewer cells.
+}
+
+\value{
+A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
+}
+\author{Robert J. Hijmans}
+
+\examples{
+r <- raster()
+r <- setValues(r, runif(ncell(r)))
+ra <- aggregate(r, fact=10, fun=max)
+}
+
+
+\keyword{methods}
+\keyword{spatial}
+
+
+
+
+
+

Deleted: pkg/raster/man/aggregate.Rd
===================================================================
--- pkg/raster/man/aggregate.Rd	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/man/aggregate.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -1,40 +0,0 @@
-\name{aggregate}
-\alias{aggregate,RasterLayer-method}
-\alias{aggregate}
-
-\title{Aggregate}
-\description{
-	Aggregate a RasterLayer to create a new raster with a lower resolution.
-}
-\usage{
-aggregate(x, fact = 2, fun = mean, expand = TRUE, rm.NA = TRUE, filename="", overwrite=FALSE, asInt = FALSE) 
-}
-
-\arguments{
-  \item{x}{a RasterLayer object}
-  \item{filename}{output filename for a new raster}
-  \item{fun}{function used to aggregate values. It should return one number. E.g. mean or max}
-  \item{fact}{degree of aggregation or disaggregation expressed as number of cells (horizontally and vertically). See details}
-  \item{expand}{if \code{expand == TRUE} grids will get larger if \code{factor} if the number of the division of the columns or rows with factor does not return an integer}
-  \item{rm.NA}{if \code{rm.NA == TRUE}, remove NA cells from calculations}
-  \item{asInt}{logical. If \code{TRUE} the values will be rounded and stored as integer}
-  \item{overwrite}{if TRUE, "filename" will be overwritten if it exists}
-}
-
-\details{
- In aggregation \code{fact = 2} will result in a grid with 2 x 2 = 4 times fewer cells.
-}
-
-\value{
-A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
-}
-\author{Robert J. Hijmans}
-
-\examples{
-	r <- raster()
-	r <- setValues(r, runif(ncell(r)))
-	ra <- aggregate(r, fact=10, fun=max)
-}
-
-\keyword{spatial}
-

Deleted: pkg/raster/man/create.raster.Rd
===================================================================
--- pkg/raster/man/create.raster.Rd	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/man/create.raster.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -1,58 +0,0 @@
-\name{new RasterLayer}
-\alias{raster}
-\alias{newRaster}
-\alias{rasterFromBbox}
-\alias{rasterFromFile}
-\alias{closeHandle}
-
-\title{ Create a new RasterLayer object }
-\description{
-  These functions create new RasterLayer objects, either from scratch or from file.
-  The created object does not contain any cell (pixel) values, it only has the parameters that describe it.
-  See read* and values() for access to the values
-  
-  newRaster has been replaced by raster, and will be removed soon. 
-}
-\usage{
-	raster(xmn = -180, xmx = 180, ymn = -90, ymx = 90, nrows = 180, ncols = 360, projstring = "+proj=longlat +datum=WGS84")
-	newRaster(xmn = -180, xmx = 180, ymn = -90, ymx = 90, nrows = 180, ncols = 360, projstring = "+proj=longlat +datum=WGS84")	
-	rasterFromBbox(bndbox, nrows = 10, ncols = 10, nudge=TRUE)
-	rasterFromFile(filename, values=FALSE, band=1)
-	closeHandle(raster)
-}
-
-\arguments{
-  \item{filename}{ name of raster data file  }
-  \item{band}{ band number in case of a file of multiple bands, default = 1 }
-  \item{xmn}{ minimum x coordinate or raster (left border) }
-  \item{xmx}{ maximum x coordinate of raster (right border) }
-  \item{ymn}{ minimum y coordinate or raster (bottom border) }
-  \item{ymx}{ maximum y coordinate of raster (top border) }
-  \item{nrows}{ number of rows on raster }
-  \item{ncols}{ number of columns on raster }
-  \item{nudge}{logical. If \code{TRUE}, the boundingbox is nudged outwards (to the next integer) }
-  \item{projstring}{ PROJ4 type description of a map projection}
-  \item{bndbox}{bounding box used to crop a raster. Any object that is or has a bounding box (see below) }
-  \item{values}{logical. If \code{TRUE}, RasterLayer values will be read into memory with 'readAll()'}
-  \item{raster}{a RasterLayer object}
-}
-\details{
-  rasterFromFile uses "GDALinfo" from the rgdal package
-  see the rgdal help for supported file types
-  closeHandle removes the handle to the file on disk that was established by rasterFromFile(). After the handle is closed, you can no longer read data from the file through the RasterLayer object. You probably do not need to do this; unless you get problems with files that cannot be overwritten (rm() does not immediately remove the handle; it seems). 
-}
-
-\value{
-  RasterLayer object
-}
-\author{Robert J. Hijmans}
-
-\seealso{  \code{\link[gdal]{rgdal}} }
-\examples{
-  r1 <- raster(nrows=1080, ncols=2160)
-  r1
-  r2 <- rasterFromFile(system.file("external/test.ag", package="sp"))
-  r2
-  logo <- rasterFromFile(system.file("pictures/Rlogo.jpg", package="rgdal"))
-}
-\keyword{ spatial }

Added: pkg/raster/man/merge-methods.Rd
===================================================================
--- pkg/raster/man/merge-methods.Rd	                        (rev 0)
+++ pkg/raster/man/merge-methods.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -0,0 +1,54 @@
+\name{merge}
+
+\docType{methods}
+\alias{merge}
+\alias{merge,RasterLayer,RasterLayer-method}
+\title{ 
+Merge RasterLayers
+
+}
+
+\description{
+Merge RasterLayers to form a new RasterLayer with a larger spatial extent
+
+This is a method for the generic function in Package `base'
+
+}
+}
+
+\section{Methods}{
+\describe{
+\code{merge(x, y, ..., tolerance=0.05, filename="", overwrite=FALSE) }
+
+\item{x,y}{"RasterLayer"}{
+  \item{...}{additional RasterLayer objects}
+  \item{tolerance}{difference permissable (relative to the cell resolution) for objects to be 'equal'. See ?all.equal}
+  \item{filename}{output filename for a new raster}
+  \item{overwrite}{if \code{TRUE}, the file will be overwritten if it exists}
+}} }
+
+\details{
+The RasterLayer objects must have the same origin and resolution. In areas where the RasterLayers overlap, the values of the RasterLayer that is first in the sequence will be retained. 
+}
+
+\value{
+A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
+}
+\author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{crop}}, \code{\link[raster]{expand}}}
+
+\examples{
+r1 <- raster(xmx=-150, ymn=60, ncols=30, nrows=30)
+r1[] <- 1:ncell(r1)
+r2 <- raster(xmn=-100, xmx=-50, ymx=50, ymn=30)
+r2 <- setRes(r2, xres(r1), yres(r1))
+r2[] <- 1:ncell(r2)
+rm <- merge(r1, r2)
+}
+
+\keyword{methods}
+\keyword{spatial}
+}
+
+

Deleted: pkg/raster/man/merge.Rd
===================================================================
--- pkg/raster/man/merge.Rd	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/man/merge.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -1,45 +0,0 @@
-\name{merge}
-\alias{merge,RasterLayer,RasterLayer-method}
-\alias{merge}
-
-\title{Merge RasterLayers}
-\description{
-Merge RasterLayers to form a new RasterLayer with a larger spatial extent
-}
-\usage{
-merge(x, y, ..., tolerance=0.05, filename="", overwrite=FALSE) 
-}
-
-\arguments{
-  \item{x}{a RasterLayer object}
-  \item{y}{a RasterLayer object}
-  \item{...}{additional RasterLayer objects}
-  \item{tolerance}{difference permissable (relative to the cell resolution) for objects to be 'equal'. See ?all.equal}
-  \item{filename}{output filename for a new raster}
-  \item{overwrite}{if \code{TRUE}, the file will be overwritten if it exists}
-}
-
-\details{
-The RasterLayer objects must have the same origin and resolution. In areas where the RasterLayers overlap, the values of the RasterLayer that is first in the sequence will be retained. 
-}
-
-\value{
-A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
-}
-
-\author{Robert J. Hijmans}
-
-\seealso{ \code{\link[raster]{crop}}, \code{\link[raster]{expand}}}
-
-
-\examples{
-r1 <- raster(xmx=-150, ymn=60, ncols=30, nrows=30)
-r1[] <- 1:ncell(r1)
-r2 <- raster(xmn=-100, xmx=-50, ymx=50, ymn=30)
-r2 <- setRes(r2, xres(r1), yres(r1))
-r2[] <- 1:ncell(r2)
-rm <- merge(r1, r2)
-}
-
-\keyword{spatial}
-

Added: pkg/raster/man/overlay-methods.Rd
===================================================================
--- pkg/raster/man/overlay-methods.Rd	                        (rev 0)
+++ pkg/raster/man/overlay-methods.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -0,0 +1,57 @@
+\name{overlay}
+\docType{methods}
+\alias{overlay}
+\alias{overlay,RasterLayer,RasterLayer-method}
+\title{ method for function overlay in the raster package}
+\description{
+Calculate values for a new RasterLayer object, based on two or more existing and RasterLayers of the same extent and resolution. 
+overlay is a generic functon used in the sp and raster packages. This help file describes its use in the raster package. 
+
+You should supply a function \code{fun} to set the way that the RasterLayers are combined. The number of arguments in the function must match the number of RasterLayer objects.
+For example, if you merge two RasterLayers you could use multiply: \code{fun=function(x,y){return(x*y)}} percentage: \code{fun=function(x,y){return(100 * x / y)}}. 
+The default function \code{sum} always works because its first argument is \code{...}
+
+In stead of the overlay function you can also use normal artimic functions (*, /, +, -) with RasterLayer objects (see examples) 
+}
+
+\section{Methods}{
+
+\code{overlay(x, y, ..., fun, filename="", overwrite=FALSE, asInt=FALSE)}
+
+
+  \item{x, y}{RasterLayer objects}
+  \item{...}{  additional RasterLayer objects and
+  \item{fun}{ the function to be appliepd. This should be a function that takes two numbers as an argument }
+  \item{filename}{ filename for the output raster. A valid filename must be provided when the data of the input rasters are on disk }
+  \item{overwrite}{logical. If \code{TRUE}, existing files will be overwritten}
+  \item{asInt}{logical. If \code{TRUE} the values will be rounded and stored as integer}
+}
+}
+
+
+\value{
+a new RasterLayer object (if a filename is provided, a file on disk)
+}
+
+\author{
+Robert J. Hijmans 
+}
+
+\examples{
+r <- raster()
+r1 <- init(r)
+r2 <- init(r)
+r3 <- overlay(r1, r2, fun=function(x,y){return(x+y)})
+
+# long version for multiplication
+r4 <- overlay(r1, r2, fun=function(x,y){return(x*y)} )
+# short function doing the same, if values can be loaded into ram memory
+r5 <- r1 * r2
+
+# multiplication with more than two layers (make sure the number of RasterLayers matches the arguments of 'fun'
+r6 <- overlay(r1, r2, r3, r4, fun=function(a,b,c,d){return(a*b+c*d)} )  
+
+}
+ 
+\keyword{methods}
+\keyword{spatial}

Deleted: pkg/raster/man/overlay.Rd
===================================================================
--- pkg/raster/man/overlay.Rd	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/man/overlay.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -1,52 +0,0 @@
-\name{overlay}
-\alias{overlay}
-\alias{overlay,RasterLayer,RasterLayer-method}
-
-\title{ Raster overlay calculation }
-\description{
-  Calculate values for a new RasterLayer object, based on two other rasters.  
-}
-
-\usage{
-	overlay(x, y, ..., fun, filename="", overwrite=FALSE, asInt=FALSE) 
-}
-
-\arguments{
-  \item{x}{ a RasterLayer object }
-  \item{y}{ a RasterLayer object }
-  \item{...}{ additional RasterLayer objects (up to 6 in total, including x and y) }
-  \item{fun}{ the function to be appliepd. This should be a function that takes two numbers as an argument }
-  \item{filename}{ filename for the output raster. A valid filename must be provided when the data of the input rasters are on disk }
-  \item{overwrite}{logical. If \code{TRUE}, existing files will be overwritten}
-  \item{asInt}{logical. If \code{TRUE} the values will be rounded and stored as integer}
-}
-
-\details{
-  The default function of overlay sums the two rasters. Here are two other examples of functions that you can use:
-  multiply: \code{fun=function(x,y){return(x*y)}}
-  percentage: \code{fun=function(x,y){return(100 * x / y)}}
-  
-  For smaller raster datasets, overlay functions can have been implemented through normal artimic functions (*, /, +, -) on RasterLayer objects (see examples)
-  
-}
-\value{
-  a new RasterLayer object (if a filename is provided, a file on disk) 
-}
-\author{ Robert J. Hijmans }
-
-\examples{
-	r <- raster()
-	r1 <- init(r)
-	r2 <- init(r)
-	r3 <- overlay(r1, r2, fun=function(x,y){return(x+y)})
-
-# long version for multiplication
-	r4 <- overlay(r1, r2, fun=function(x,y){return(x*y)} )
-# short function doing the same, if values can be loaded into ram memory
-	r5 <- r1 * r2
-
-# multiplication with more than two layers (make sure the number of RasterLayers matches the arguments of 'fun'
-	r6 <- overlay(r1, r2, r3, r4, fun=function(a,b,c,d){return(a*b+c*d)} )	
-}	
-
-\keyword{ spatial }

Added: pkg/raster/man/raster.Rd
===================================================================
--- pkg/raster/man/raster.Rd	                        (rev 0)
+++ pkg/raster/man/raster.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -0,0 +1,44 @@
+\name{new RasterLayer}
+\alias{raster}
+\alias{rasterFromBbox}
+
+\title{Create a new RasterLayer object }
+\description{
+  These functions create new RasterLayer objects
+  The created object does normally not contain any cell (pixel) values, it only has the parameters that describe the RasterLayer.
+}
+
+\usage{
+raster(xmn = -180, xmx = 180, ymn = -90, ymx = 90, nrows = 180, ncols = 360, projstring = "+proj=longlat +datum=WGS84")
+rasterFromBbox(bndbox, nrows = 10, ncols = 10, nudge=TRUE)
+}
+
+\arguments{
+  \item{xmn}{minimum x coordinate or raster (left border) }
+  \item{xmx}{maximum x coordinate of raster (right border) }
+  \item{ymn}{minimum y coordinate or raster (bottom border) }
+  \item{ymx}{maximum y coordinate of raster (top border) }
+  \item{nrows}{number of rows on raster }
+  \item{ncols}{number of columns on raster }
+  \item{nudge}{logical. If \code{TRUE}, the boundingbox is nudged outwards (to the next integer) }
+  \item{projstring}{PROJ4 type description of a map projection}
+  \item{bndbox}{bounding box used to crop a raster. Any object that is a BoundingBox object or contains one (such as Raster* objects)}
+}
+
+\details{
+New RasterLayer objects have no values. You can set values with the \code{init} function or with a 'replacement function' (see example)
+}
+
+\value{
+RasterLayer object
+}
+\author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{setValues},  \link[raster]{init}, \link[raster]{newBbox},  \link[raster]{stack}} }
+\examples{
+r1 <- raster(nrows=108, ncols=21, xmn=0, xmx=10)
+r2 <- rasterFromBbox(r1)
+r2[] <- runif(ncell(r2))
+}
+
+\keyword{spatial }

Added: pkg/raster/man/rasterFromFile.Rd
===================================================================
--- pkg/raster/man/rasterFromFile.Rd	                        (rev 0)
+++ pkg/raster/man/rasterFromFile.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -0,0 +1,35 @@
+\name{RasterLayer from file}
+\alias{rasterFromFile}
+
+\title{Create a new RasterLayer object }
+\description{
+  Create a new RasterLayer object from a file. The created object does normally not contain any cell (pixel) values, it only has the parameters that describe the RasterLayer.
+}
+
+\usage{
+rasterFromFile(filename, values=FALSE, band=1)
+}
+
+\arguments{
+  \item{filename}{name of raster data file  }
+  \item{band}{band number in case of a file of multiple bands, default = 1 }
+  \item{values}{logical. If \code{TRUE}, RasterLayer values will be read into memory with 'readAll()'}
+}
+
+\details{
+ Supported file types are the 'native' raster package format and those that can be read via rgdal. See ?readGDAL help for supported file types.
+ \n  See read* and values() for access to the values. 
+}
+
+\value{
+RasterLayer object
+}
+\author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{readAll}, \link[raster]{values},  \link[raster]{raster}, \link[raster]{stack},  \link[gdal]{readGDAL} } }
+\examples{
+r <- rasterFromFile(system.file("external/test.ag", package="sp"))
+logo <- rasterFromFile(system.file("pictures/Rlogo.jpg", package="rgdal"))
+}
+
+\keyword{spatial }

Deleted: pkg/raster/man/rasterdistance.Rd
===================================================================
--- pkg/raster/man/rasterdistance.Rd	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/man/rasterdistance.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -1,28 +0,0 @@
-\name{distance-methods}
-\docType{methods}
-\alias{distance-methods}
-\alias{distance}
-\alias{distance,RasterLayer-method}
-\title{ Calculate distance from geographic features in a raster}
-\description{
- The function calculates the distance from the non-NA cells of the RasterLayer.
- 
- The distance is in meters if the RasterLayer is in a geographic (latlon) projection and in map units when not projected.
- 
- Distances are calculated by summing local distances between cells, which are connected with their neighbours in 8 directions.
- 
- For more options (directions, cost-distance) see the gdistance package.
-}
-\section{Methods}{
-\describe{
-
-\item{raster = "RasterLayer"}{ ~~describe this method here }
-}}
-\examples{
-r1 <- raster(ncol=36,nrow=18)
-r1[345:355] <- 1
-distmap <- distance(r1) 
-#plot(distmap)
-}
-\keyword{methods}
-\keyword{spatial}

Modified: pkg/raster/man/write.Rd
===================================================================
--- pkg/raster/man/write.Rd	2009-02-07 01:47:36 UTC (rev 251)
+++ pkg/raster/man/write.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -30,42 +30,31 @@
 	When writing by row, you must write all rows, and you must write them in sequence. Start at row=1, and end at row=nrow(raster). You cannot overwrite a single row in an existing raster file.
 	rasterWriteFormats returns a matrix of the file formats (the "drivers") that are supported.
 
-Supported formats include 
+Supported formats include:
 
-Format
-	Long name
+\tabular{rll}{
+	\tab Format \tab Long name \cr
+    \tab raster \tab 'Native' raster package format \cr
+    \tab ascii  \tab ESRI Ascii \cr
+    \tab ENVI   \tab ENVI .hdr Labelled \cr
+    \tab EHdr   \tab ESRI .hdr Labelled \cr
+    \tab ERS  \tab ERMapper .ers Labelled \cr
+    \tab GTiff  \tab GeoTiff \cr
+    \tab HFAErdas  \tab Imagine Images (.img) \cr
+    \tab ILWIS   \tab ILWIS Raster Map \cr
+    \tab PAux   \tab PCI .aux Labelled \cr
+    \tab PCIDSK   \tab PCIDSK Database File \cr
+    \tab RST  \tab  Idrisi Raster A.1
+}
 
-raster
-	'Native' raster package format
-	
-ascii
-	Arc Ascii format
-	
-\item{ENVI}{ENVI .hdr Labelled}
-	
-	EHdr        ESRI .hdr Labelled
-	
-	ERS         ERMapper .ers Labelled
-	
-	GTiff       GeoTiff
-	
-	HFAErdas    Imagine Images (.img)
-	
-	ILWIS       ILWIS Raster Map
-	
-	PAux        PCI .aux Labelled
-	
-	PCIDSK      PCIDSK Database File
-	
-	RST         Idrisi Raster A.1
-	
 }
 
+
 \author{Robert J. Hijmans}
 
-\seealso{ \code{\link[rgdal]{rgdal}} }
-\examples{ 
+\seealso{ \code{\link[rgdal]{writeGDAL}} }
 
+\examples{ 
  rs <- rasterFromFile(system.file("external/test.ag", package="sp"))
  
 #read all data

Added: pkg/raster/man/writeadvanced.Rd
===================================================================
--- pkg/raster/man/writeadvanced.Rd	                        (rev 0)
+++ pkg/raster/man/writeadvanced.Rd	2009-02-07 06:52:06 UTC (rev 252)
@@ -0,0 +1,25 @@
+\name{advanced raster file writing}
+\alias{closeHandle}
+
+\title{ Create a new RasterLayer object }
+\description{ low level functions for programmers 
+}
+\usage{
+closeHandle(raster)
+}
+
+\arguments{
+  \item{raster}{a RasterLayer object}
+}
+\details{
+  closeHandle removes the handle to the file on disk that was established by rasterFromFile(). After the handle is closed, you can no longer read data from the file through the RasterLayer object. You probably do not need to do this; unless you get problems with files that cannot be overwritten (rm() does not immediately remove the handle; it seems). 
+}
+
+\value{
+  RasterLayer object
+}
+\author{Robert J. Hijmans}
+
+\examples{
+}
+\keyword{ spatial }



More information about the Raster-commits mailing list