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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 5 13:23:25 CET 2009


Author: rhijmans
Date: 2009-03-05 13:23:25 +0100 (Thu, 05 Mar 2009)
New Revision: 314

Added:
   pkg/raster/R/changeExtent.R
   pkg/raster/man/newBbox.Rd
   pkg/raster/man/setExtent.Rd
   pkg/raster/man/shift.Rd
Removed:
   pkg/raster/man/setBbox.Rd
Modified:
   pkg/raster/DESCRIPTION
   pkg/raster/R/Merge.R
   pkg/raster/R/addToStack.R
   pkg/raster/R/aggregate.R
   pkg/raster/R/bounding.box.R
   pkg/raster/R/coercion.R
   pkg/raster/R/crop.R
   pkg/raster/R/depracated.R
   pkg/raster/R/expand.R
   pkg/raster/R/map.R
   pkg/raster/R/project.R
   pkg/raster/R/readRandom.R
   pkg/raster/R/readSkip.R
   pkg/raster/R/reclass.R
   pkg/raster/R/replaceProperties.R
   pkg/raster/R/set.R
   pkg/raster/R/setBbox.R
   pkg/raster/man/Compare-methods.Rd
   pkg/raster/man/getBbox.Rd
   pkg/raster/man/reclass.Rd
Log:


Modified: pkg/raster/DESCRIPTION
===================================================================
--- pkg/raster/DESCRIPTION	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/DESCRIPTION	2009-03-05 12:23:25 UTC (rev 314)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Raster data handling for geographic data analysis and modeling
 Version: 0.8.9-2
-Date: 4-March-2009
+Date: 5-March-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/R/Merge.R
===================================================================
--- pkg/raster/R/Merge.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/Merge.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -25,7 +25,7 @@
 	bb <- unionBbox(rasters)
 	outraster <- setRaster(rasters[[1]], filename)
 #	bndbox <- newBbox(bb[1,1], bb[1,2], bb[2,1], bb[2,2])
-	outraster <- setBbox(outraster, bb, keepres=TRUE, snap=FALSE)
+	outraster <- setExtent(outraster, bb, keepres=TRUE, snap=FALSE)
 
 	isint <- TRUE
 	for (i in 1:length(rasters)) {

Modified: pkg/raster/R/addToStack.R
===================================================================
--- pkg/raster/R/addToStack.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/addToStack.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -52,7 +52,7 @@
 				rstack <- raster
 			} else {
 				rstack <- setRowCol(rstack, nrow(raster), ncol(raster))
-				rstack <- setBbox(rstack, raster, snap=FALSE)
+				rstack <- setExtent(rstack, raster, snap=FALSE)
 				rstack <- setProjection(rstack, projection(raster))
 
 				nl <- rstack at data@nlayers + nlayers(raster)

Modified: pkg/raster/R/aggregate.R
===================================================================
--- pkg/raster/R/aggregate.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/aggregate.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -41,7 +41,7 @@
 	outRaster <- setRaster(x, filename)
 	outRaster <- setDatatype(outRaster, datatype)
 	bndbox <- newBbox(xmin(x), xmx, ymn, ymax(x))
-	outRaster <- setBbox(outRaster, bndbox, keepres=F)
+	outRaster <- setExtent(outRaster, bndbox, keepres=F)
 	outRaster <- setRowCol(outRaster, nrows=rsteps, ncols=csteps) 
 	
 	if (dataContent(x) == 'all') {	

Modified: pkg/raster/R/bounding.box.R
===================================================================
--- pkg/raster/R/bounding.box.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/bounding.box.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -8,17 +8,6 @@
 
 
 
-
-changeBbox <- function(object, xmn=xmin(object), xmx=xmax(object), ymn=ymin(object), ymx = ymax(object), keepres=FALSE) {
-	bb <- newBbox(xmn, xmx, ymn, ymx) 
-	if (class(object) == 'BoundingBox') { 
-		return(bb)
-	}
-	object <- setBbox(object, bb, keepres=keepres) 
-	return(object)
-}
-
-
 newBbox <- function(xmn, xmx, ymn, ymx) {
 	bb <- new('BoundingBox')
 	bb at xmin <- xmn

Added: pkg/raster/R/changeExtent.R
===================================================================
--- pkg/raster/R/changeExtent.R	                        (rev 0)
+++ pkg/raster/R/changeExtent.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -0,0 +1,26 @@
+# R function for the raster package
+# Author: Robert J. Hijmans
+# International Rice Research Institute. Philippines
+# contact: r.hijmans at gmail.com
+# Date : January 2009
+# Version 0.8
+# Licence GPL v3
+
+
+
+changeExtent <- function(x, xmn=xmin(x), xmx=xmax(x), ymn=ymin(x), ymx = ymax(x), keepres=FALSE) {
+	bb <- newBbox(xmn, xmx, ymn, ymx) 
+	if (class(x) == 'BoundingBox') { 
+		return(bb)
+	}
+	x <- setExtent(x, bb, keepres=keepres) 
+	return(x)
+}
+
+shift <- function(object, x=0, y=0) {
+	object at bbox@xmin <- object at bbox@xmin + x
+	object at bbox@ymin <- object at bbox@ymin + y
+	object at bbox@xmax <- object at bbox@xmax + x
+	object at bbox@ymax <- object at bbox@ymax + y
+	return(object)
+}

Modified: pkg/raster/R/coercion.R
===================================================================
--- pkg/raster/R/coercion.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/coercion.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -119,7 +119,7 @@
 			}
 		} else {
 			rs <- new("RasterLayer")
-			rs <- setBbox(rs, getBbox(x))
+			rs <- setExtent(rs, getBbox(x))
 			rs <- setRowCol(rs, nrow(x), ncol(x))
 		}
 		return(rs)
@@ -131,7 +131,7 @@
 setMethod('asRasterLayer', signature(x='SpatialPixelsDataFrame'), 
 	function(x, index){
 		r <- raster()
-		r <- setBbox(r, getBbox(x))
+		r <- setExtent(r, getBbox(x))
 		r <- setProjection(r, x at proj4string)
 		r <- setRowCol(r, x at grid@cells.dim[2], x at grid@cells.dim[1])
 		dindex <- max(1, min(dim(x at data)[2], index))
@@ -157,7 +157,7 @@
 setMethod('asRasterLayer', signature(x='SpatialGridDataFrame'), 
 	function(x, index){
 		r <- raster()
-		r <- setBbox(r, getBbox(x))
+		r <- setExtent(r, getBbox(x))
 		r <- setProjection(r, x at proj4string)
 		r <- setRowCol(r, x at grid@cells.dim[2], x at grid@cells.dim[1])
 		dindex <- max(1, min(dim(x at data)[2], index))
@@ -172,7 +172,7 @@
 
 .asRasterStack <- function(spgrid) {
 	stk <- new("RasterStack")
-	stk <- setBbox(stk, getBbox(spgrid))
+	stk <- setExtent(stk, getBbox(spgrid))
 	stk <- setProjection(stk, spgrid at proj4string)
 	stk <- setRowCol(stk, spgrid at grid@cells.dim[2], spgrid at grid@cells.dim[1])
 	

Modified: pkg/raster/R/crop.R
===================================================================
--- pkg/raster/R/crop.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/crop.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -13,7 +13,7 @@
 	bb <- intersectBbox(c(raster, bndbox))
 	bb <- alignBbox(bb, raster)
 	outraster <- setRaster(raster, filename)
-	outraster <- setBbox(outraster, bb, keepres=T)
+	outraster <- setExtent(outraster, bb, keepres=T)
 	
 	if (dataContent(raster) == 'all')  {
 		first_start_cell <- cellFromXY(raster, c(xmin(outraster) + 0.5 * xres(raster), ymax(outraster) - 0.5 * yres(raster) ))	

Modified: pkg/raster/R/depracated.R
===================================================================
--- pkg/raster/R/depracated.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/depracated.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -1,6 +1,8 @@
 
 # no longer used. Use calc instead. See ?calc
 
+
+
 ...isNA <- function(raster, value=0, filename="", overwrite=FALSE, asInt=FALSE) {
 	fun <- function(x) { x[is.na(x)] <- value; return(x)} 
 	if (asInt) { datatype <- 'INT4S' } else { datatype <- 'FLT4S' }
@@ -18,6 +20,6 @@
 	} else if (operator == "!=") { fun <- function(x) { x[x!=value] <- NA; return(x)}
 	}
 	if (asInt) { datatype <- 'INT4S' } else { datatype <- 'FLT4S' }
-	return(calc(raster, fun, filename, overwrite=overwrite, datatype))
+	return( calc(raster, fun, filename, overwrite=overwrite, datatype))
 }
 

Modified: pkg/raster/R/expand.R
===================================================================
--- pkg/raster/R/expand.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/expand.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -26,7 +26,7 @@
 	
 	outraster <- setRaster(raster, filename)
 	bndbox <- newBbox(xmn, xmx, ymn, ymx)
-	outraster <- setBbox(outraster, bndbox, keepres=T)
+	outraster <- setExtent(outraster, bndbox, keepres=T)
 
 	startrow <- rowFromY(outraster, ymax(raster))
 	startcol <- colFromX(outraster, xmin(raster))

Modified: pkg/raster/R/map.R
===================================================================
--- pkg/raster/R/map.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/map.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -41,8 +41,8 @@
 			sampraster <- setRowCol(sampraster, dim(m)[1], dim(m)[2])
 			xmx <- xmax(object) - (ncol(object) - cols[length(cols)]) * xres(object)
 			ymn <- ymin(object) + (nrow(object) - rows[length(rows)]) * yres(object)
-			bndbox <- changeBbox(object, xmx=xmx, ymn=ymn)
-			object <- setBbox(sampraster, bndbox, keepres=F)
+			bndbox <- changeExtent(object, xmx=xmx, ymn=ymn)
+			object <- setExtent(sampraster, bndbox, keepres=F)
  		} else { 
 			m <- values(object, format='matrix')
 			subsample=FALSE

Modified: pkg/raster/R/project.R
===================================================================
--- pkg/raster/R/project.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/project.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -22,7 +22,7 @@
 	ymin <- min(p[,2])
 	ymax <- max(p[,2])	
 	bb <- newBbox(xmin, xmax, ymin, ymax)
-	obj <- setBbox(object, bb)
+	obj <- setExtent(object, bb)
 	obj <- setProjection(obj, projstring)
 	return(obj)
 }

Modified: pkg/raster/R/readRandom.R
===================================================================
--- pkg/raster/R/readRandom.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/readRandom.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -92,8 +92,8 @@
 		outras <- setRowCol(outras, nr, nc)
 		xmx <- xmax(raster) - (ncol(raster) - cols[nc]) * xres(raster)
 		ymn <- ymin(raster) + (nrow(raster) - row) * yres(raster)
-		bndbox <- changeBbox(raster, xmx=xmx, ymn=ymn)
-		outras <- setBbox(outras, bndbox, keepres=F)
+		bndbox <- changeExtent(raster, xmx=xmx, ymn=ymn)
+		outras <- setExtent(outras, bndbox, keepres=F)
 		outras <- setValues(outras, dd)
 		return(outras)
 	} else {

Modified: pkg/raster/R/readSkip.R
===================================================================
--- pkg/raster/R/readSkip.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/readSkip.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -50,8 +50,8 @@
 		outras <- setRowCol(outras, nr, nc)
 		xmx <- xmax(raster) - (ncol(raster) - cols[nc]) * xres(raster)
 		ymn <- ymin(raster) + (nrow(raster) - row) * yres(raster)
-		bndbox <- changeBbox(raster, xmx=xmx, ymn=ymn)
-		outras <- setBbox(outras, bndbox, keepres=F)
+		bndbox <- changeExtent(raster, xmx=xmx, ymn=ymn)
+		outras <- setExtent(outras, bndbox, keepres=F)
 		outras <- setValues(outras, dd)
 	}
 	if (asRaster) {

Modified: pkg/raster/R/reclass.R
===================================================================
--- pkg/raster/R/reclass.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/reclass.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -12,11 +12,15 @@
 	if ( is.null(dim(rclmat)) ) { 
 		rclmat <- matrix(rclmat, ncol=3, byrow=TRUE) 
 	} else if ( dim(rclmat)[2] == 1 ) { 
-		rclmat <- matrix(rclmat, ncol=3, byrow=TRUE) }
+		rclmat <- matrix(rclmat, ncol=3, byrow=TRUE) 
+	}
 	if ( dim(rclmat)[2] != 3 ) { stop('rclmat must have 3 columns') }
 	colnames(rclmat) <- c("From", "To", "Becomes")	
-	print(rclmat)
 	
+	if (options('verbose')[[1]]) {
+		print(rclmat)
+	}
+	
 	outraster <- setRaster(raster, filename)
 	outraster <- setDatatype(outraster, datatype) 
 

Modified: pkg/raster/R/replaceProperties.R
===================================================================
--- pkg/raster/R/replaceProperties.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/replaceProperties.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -34,18 +34,18 @@
 }
 
 'xmin<-' <- function(x, value) {
-	return(changeBbox(x, xmn=value))
+	return(changeExtent(x, xmn=value))
 }
 
 'xmax<-' <- function(x, value) {
-	return(changeBbox(x, xmx=value))
+	return(changeExtent(x, xmx=value))
 }
 
 'ymin<-' <- function(x, value) {
-	return(changeBbox(x, ymn=value))
+	return(changeExtent(x, ymn=value))
 }
 
 'ymax<-' <- function(x, value) {
-	return(changeBbox(x, ymx=value))
+	return(changeExtent(x, ymx=value))
 }
 

Modified: pkg/raster/R/set.R
===================================================================
--- pkg/raster/R/set.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/set.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -26,7 +26,7 @@
 	nr <- round( (bb at ymax - bb at ymin) / yres )
 	bb at xmax <- bb at xmin + nc * xres
 	bb at ymin <- bb at ymax - nr * yres
-	object	<- setBbox(object, bb)
+	object	<- setExtent(object, bb)
 	object <- setRowCol(object, nr, nc)
 	return(object)
 }
@@ -93,7 +93,7 @@
 	if (class(object) == 'BoundingBox') {
 		return(b)
 	}
-	object <- setBbox(object, b)
+	object <- setExtent(object, b)
 	return(object)
 }
 

Modified: pkg/raster/R/setBbox.R
===================================================================
--- pkg/raster/R/setBbox.R	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/R/setBbox.R	2009-03-05 12:23:25 UTC (rev 314)
@@ -7,10 +7,11 @@
 # Licence GPL v3
 
 
-setBbox <- function(object, bndbox, keepres=FALSE, snap=FALSE) {
-	oldbb <- getBbox(object)
+setExtent <- function(x, bndbox, keepres=FALSE, snap=FALSE) {
+
+	oldbb <- getBbox(x)
 	bb <- getBbox(bndbox)
-	newobj <- clearValues(object)
+	newobj <- clearValues(x)
 	
 	if (snap) {
 		bb <- alignBbox(bb, newobj)
@@ -19,8 +20,8 @@
 	newobj at bbox <- bb
 	
 	if (keepres) {
-		xrs <- xres(object)
-		yrs <- yres(object)
+		xrs <- xres(x)
+		yrs <- yres(x)
 		nc <- as.integer(round( (xmax(newobj) - xmin(newobj)) / xrs ))
 		if (nc < 1) { stop( "xmin and xmax are less than one cell apart" ) 
 		} else { newobj at ncols <- nc }
@@ -30,14 +31,14 @@
 		newobj at bbox@xmax <- newobj at bbox@xmin + ncol(newobj) * xrs
 		newobj at bbox@ymax <- newobj at bbox@ymin + nrow(newobj) * yrs
 		
-		if (dataContent(object) == 'all') {
-			indices <- cellsFromBbox(object, bb)
-			newobj <- setValues(newobj, values(object)[indices])
+		if (dataContent(x) == 'all') {
+			indices <- cellsFromBbox(x, bb)
+			newobj <- setValues(newobj, values(x)[indices])
 		}
-	} else if (class(object) != "BasicRaster") {
-		if (ncol(object)==ncol(newobj) & nrow(object)==nrow(newobj))  {
-			if (dataContent(object) == 'all') {
-				newobj <- setValues(newobj, values(object))
+	} else if (class(x) != "BasicRaster") {
+		if (ncol(x)==ncol(newobj) & nrow(x)==nrow(newobj))  {
+			if (dataContent(x) == 'all') {
+				newobj <- setValues(newobj, values(x))
 			}	
 		}
 	}

Modified: pkg/raster/man/Compare-methods.Rd
===================================================================
--- pkg/raster/man/Compare-methods.Rd	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/man/Compare-methods.Rd	2009-03-05 12:23:25 UTC (rev 314)
@@ -23,7 +23,7 @@
 r3 <- r1 == r2
 
 b <- newBbox(0, 360, 0, 180)
-r4 <- setBbox(r2, b)
+r4 <- setExtent(r2, b)
 as(r2, "BasicRaster") != as(r4, "BasicRaster")
 # The following would give an error. You cannot compare RasterLayer object that do not have the same BasicRaster properties.
 #r3 <- r1 > r4

Modified: pkg/raster/man/getBbox.Rd
===================================================================
--- pkg/raster/man/getBbox.Rd	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/man/getBbox.Rd	2009-03-05 12:23:25 UTC (rev 314)
@@ -1,4 +1,4 @@
-\name{getBoundingBox}
+\name{getBBox}
 
 \alias{getBbox}
 \alias{getBbox,BoundingBox-method}

Added: pkg/raster/man/newBbox.Rd
===================================================================
--- pkg/raster/man/newBbox.Rd	                        (rev 0)
+++ pkg/raster/man/newBbox.Rd	2009-03-05 12:23:25 UTC (rev 314)
@@ -0,0 +1,43 @@
+\name{newBbox}
+
+\alias{newBbox}
+\alias{alignBbox}
+  
+\title{create or align a BoundingBox}
+
+\description{
+
+newBbox creates a new BoundingBox object
+alignBbox aligns a bounding box with the cells of a Raster* object
+
+}
+
+\usage{
+newBbox(xmn, xmx, ymn, ymx)
+alignBbox(bndbox, object)
+}
+
+\arguments{
+  \item{xmn}{the minimum x coordinate of the bounding box}
+  \item{xmx}{the maximum x coordinate of the bounding box}
+  \item{ymn}{the minimum y coordinate of the bounding box}
+  \item{ymx}{the maximum y coordinate of the bounding box}
+  \item{bndbox}{An object of class BoundingBox (which you can create with newBbox() )}  
+  \item{object}{A Raster* object}
+}
+ 
+\value{
+a BoundingBox object
+}
+  
+\author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{getBoungingBox}}, \code{\link[raster]{BoungingBox-class}}, \code{\link[raster]{clickBbox}} }
+
+\examples{
+r <- raster()
+bb <- newBbox(-10.1, 10.1, -20.1, 20.1)
+bba <- alignBbox(bb, r)
+}
+
+\keyword{spatial}

Modified: pkg/raster/man/reclass.Rd
===================================================================
--- pkg/raster/man/reclass.Rd	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/man/reclass.Rd	2009-03-05 12:23:25 UTC (rev 314)
@@ -2,7 +2,8 @@
 
 \alias{reclass}
 
-\title{Reclassify values of a RasterLayer}
+\title{Reclassify}
+
 \description{
 Reclassify values of a RasterLayer
 }
@@ -12,7 +13,7 @@
 
 \arguments{
   \item{raster}{A RasterLayer object}
-  \item{rclmat}{Matrix for reclassifcation. (see below)}
+  \item{rclmat}{Matrix (or vector) for reclassifcation. (see below)}
   \item{filename}{Output filename for a new raster; if NA the result is not written to a file but returned with the RasterLayer object, in the data slot}
   \item{overwrite}{Logical to indicate whether an existing output file should be overwritten}
   \item{filetype}{output file type. Either 'raster', 'ascii' or a supported GDAL 'driver' name see \code{\link[raster]{writeRaster}}}
@@ -22,13 +23,18 @@
 
 \details{
 \code{reclass} reclassifies groups of values to other values. E.g. All values between 1 and 10 become 1, and between 11 and 15 become 2. 
-Reclassification is done with matrix "rclmat". This matrix must have 3 columns. The first two columns are "from" "to" of the input values, and the third column has the new value for that range.
+Reclassification is done with matrix "rclmat". This matrix must have 3 columns. 
+The first two columns are "from" "to" of the input values, and the third column has the new value for that range.
+A reclass is applied to  \code{from < x <= to}, so make sure you include a start value below the lowest value
+
+You can also supply a vector that can be coecred into a n*3 matrix
 	
 If the input RasterLayer object has all values in memory (e.g. after readAll(raster)), the function will also return the new values in memory. If a filename is provided, the values will also be saved to that file. 
 If the values are not in memory the new values will be written to file. 
 }
+
 \value{
-A new RasterLayer object (in the R environment), and in some cases the side effect of a new file on disk.
+A new RasterLayer object, and in some cases the side effect of a new file on disk.
 }
 
 \author{Robert J. Hijmans}
@@ -38,10 +44,14 @@
 r <- raster(ncols=36, nrows=18)
 r[] <- runif(ncell(r)) 
 # reclassify the values into three groups 
-# all values between 0 and 0.25 become 1, etc.
+# all values between > 0 and <= 0.25 become 1, etc.
 m <- c(0, 0.25, 1,  0.25, 0.5, 2,  0.5, 1, 3)
 rclmat <- matrix(m, ncol=3, byrow=TRUE)
 rc <- reclass(r, rclmat)
- 
+
+# equivalent to
+m <- c(-Inf, 0.25, 1,  0.25, 0.5, 2,  0.5, Inf, 3)
+rc <- reclass(r, m)
 }
+
 \keyword{spatial}

Deleted: pkg/raster/man/setBbox.Rd
===================================================================
--- pkg/raster/man/setBbox.Rd	2009-03-05 08:26:03 UTC (rev 313)
+++ pkg/raster/man/setBbox.Rd	2009-03-05 12:23:25 UTC (rev 314)
@@ -1,57 +0,0 @@
-\name{setBoundingBox}
-
-\alias{newBbox}
-\alias{setBbox}
-\alias{changeBbox}
-\alias{alignBbox}
-\alias{xmin<-}
-\alias{xmax<-}
-\alias{ymin<-}
-\alias{ymax<-}
-  
-\title{create or change a BoundingBox}
-\description{
-newBbox creates a new BoundingBox object
-getBbox extracts a bounding box from a Raster* or Spatial* object (or from a BoundingBox object). It will also create a BoundingBox object from a matrix (2 x 2) or vector (length=4)
-setBbox sets the bounding box of a Raster* object
-changeBbox changes the bounding box of a Raster* object
-alignBbox aligns a bounding box with the cells of a Raster* object
-}
-
-\usage{
-newBbox(xmn, xmx, ymn, ymx)
-setBbox(object, bndbox, keepres=FALSE, snap=FALSE)
-changeBbox(object, xmn=xmin(object), xmx=xmax(object), ymn=ymin(object), ymx = ymax(object), keepres=FALSE) 
-alignBbox(bndbox, object)
-}
-
-\arguments{
-  \item{xmn}{the minimum x coordinate of the bounding box}
-  \item{xmx}{the maximum x coordinate of the bounding box}
-  \item{ymn}{the minimum y coordinate of the bounding box}
-  \item{ymx}{the maximum y coordinate of the bounding box}
-  \item{object}{A Raster* object}
-  \item{bndbox}{An object of class BoundingBox (which you can create with newBbox() )}  
-  \item{keepres}{logical. If \code{TRUE}, the resolution of the cells will stay the same after adjusting the bounding box (by adjusting the number of rows and columns). if \code{FALSE}, the number of rows and columns will stay the same, and the resolution will be adjusted}
-  \item{snap}{logical. If \code{TRUE}, the BoundingBox is adjusted so that the cells of the output RasterLayer are aligned with those of the input RasterLayer }
-}
- 
-\value{
-a BoundingBox object, except for setBbox which returns an Raster* object
-}
-  
-\author{Robert J. Hijmans}
-
-\seealso{ \code{\link[raster]{getBoungingBox}}, \code{\link[raster]{BoungingBox-class}}, \code{\link[raster]{clickBbox}} }
-
-\examples{
-r <- raster()
-bb <- newBbox(-10, 10, -20, 20)
-r <- setBbox(r, bb, keepres=TRUE)
-r <- changeBbox(r, xmn=xmin(r)+1, xmx=xmax(r)+1)
-# change BoundingBox coordinates one by one
-xmin(r) <- -30
-ymax(r) <- 60
-}
-
-\keyword{spatial}

Added: pkg/raster/man/setExtent.Rd
===================================================================
--- pkg/raster/man/setExtent.Rd	                        (rev 0)
+++ pkg/raster/man/setExtent.Rd	2009-03-05 12:23:25 UTC (rev 314)
@@ -0,0 +1,55 @@
+\name{setExtent}
+
+\alias{setExtent}
+\alias{changeExtent}
+\alias{xmin<-}
+\alias{xmax<-}
+\alias{ymin<-}
+\alias{ymax<-}
+  
+\title{change extent of a RasteLayer}
+
+\description{
+
+setExtent sets a new bounding box of a RasterLayer
+
+changeExtent changes the bounding box of a Raster* object
+
+the extent can also be changed by assignment functions (e.g. \code{xmin(x) <- -180}).
+}
+
+\usage{
+setExtent(x, bndbox, keepres=FALSE, snap=FALSE)
+changeExtent(x, xmn=xmin(x), xmx=xmax(x), ymn=ymin(x), ymx = ymax(x), keepres=FALSE) 
+}
+
+\arguments{
+  \item{x}{A Raster* object}
+  \item{bndbox}{An object of class BoundingBox (which you can create with newBbox() )}  
+  \item{keepres}{logical. If \code{TRUE}, the resolution of the cells will stay the same after adjusting the bounding box (by adjusting the number of rows and columns). if \code{FALSE}, the number of rows and columns will stay the same, and the resolution will be adjusted}
+  \item{snap}{logical. If \code{TRUE}, the object's BoundingBox is adjusted so that the cells of the output RasterLayer are aligned with those of the input RasterLayer }
+  \item{xmn}{the minimum x coordinate of the object}
+  \item{xmx}{the maximum x coordinate of the object}
+  \item{ymn}{the minimum y coordinate of the object}
+  \item{ymx}{the maximum y coordinate of the object}
+  
+}
+ 
+\value{
+a Raster* object
+}
+  
+\author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{getBbox}}, \code{\link[raster]{BoungingBox-class}}, \code{\link[raster]{clickBbox}} }
+
+\examples{
+r <- raster()
+bb <- newBbox(-10, 10, -20, 20)
+r <- setExtent(r, bb, keepres=TRUE)
+r <- changeExtent(r, xmn=xmin(r)+1, xmx=xmax(r)+1)
+xmin(r) <- -30
+ymax(r) <- 60
+}
+
+\keyword{spatial}

Added: pkg/raster/man/shift.Rd
===================================================================
--- pkg/raster/man/shift.Rd	                        (rev 0)
+++ pkg/raster/man/shift.Rd	2009-03-05 12:23:25 UTC (rev 314)
@@ -0,0 +1,35 @@
+\name{shift}
+
+\alias{shift}
+  
+\title{shift}
+
+\description{
+shift the location of a Raster* object in the x and/or y direction
+}
+
+\usage{
+shift(object, x=0, y=0)
+}
+
+\arguments{
+  \item{object}{A Raster* object}
+  \item{x}{The shift in horizontal direction}
+  \item{y}{The shift in vertical direction}
+  
+}
+ 
+\value{
+a Raster* object
+}
+  
+\author{Robert J. Hijmans}
+
+\seealso{ \code{\link[raster]{getBbox}}, \code{\link[raster]{BoungingBox-class}}, \code{\link[raster]{clickBbox}} }
+
+\examples{
+r <- raster()
+r <- shift(r, x=1, y=-1)
+}
+
+\keyword{spatial}



More information about the Raster-commits mailing list