[Raster-commits] r450 - in pkg/raster: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 12 07:31:09 CEST 2009
Author: rhijmans
Date: 2009-05-12 07:31:08 +0200 (Tue, 12 May 2009)
New Revision: 450
Modified:
pkg/raster/DESCRIPTION
pkg/raster/R/Merge.R
pkg/raster/R/aggold.R
pkg/raster/R/aggregate.R
pkg/raster/R/bboxUnion.R
pkg/raster/R/bounding.box.R
pkg/raster/R/cellsFromBbox.R
pkg/raster/R/crop.R
pkg/raster/R/dataType.R
pkg/raster/R/drawBox.R
pkg/raster/R/expand.R
pkg/raster/R/getBbox.R
pkg/raster/R/plotBbox.R
pkg/raster/R/projectRaster.R
pkg/raster/R/raster.R
pkg/raster/R/rasterFromCells.R
pkg/raster/R/resample.R
pkg/raster/R/resolution.R
pkg/raster/R/setExtent.R
pkg/raster/man/Compare-methods.Rd
pkg/raster/man/cellsFromBbox.Rd
pkg/raster/man/crop.Rd
pkg/raster/man/expand.Rd
pkg/raster/man/extent.Rd
pkg/raster/man/intersectBbox.Rd
pkg/raster/man/newBbox.Rd
pkg/raster/man/polygonFromBbox.Rd
pkg/raster/man/setExtent.Rd
pkg/raster/man/unionBbox.Rd
Log:
Modified: pkg/raster/DESCRIPTION
===================================================================
--- pkg/raster/DESCRIPTION 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/DESCRIPTION 2009-05-12 05:31:08 UTC (rev 450)
@@ -1,8 +1,8 @@
Package: raster
Type: Package
Title: Raster data handling for geographic data analysis and modeling
-Version: 0.8.9-17
-Date: 8-May-2009
+Version: 0.8.9-18
+Date: 12-May-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-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/Merge.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -21,9 +21,8 @@
compare(rasters, bb=FALSE, rowcol=FALSE, orig=TRUE, res=TRUE, tolerance=tolerance)
- bb <- unionBbox(rasters)
+ bb <- unionExtent(rasters)
outraster <- raster(rasters[[1]], filename)
-# bndbox <- newBbox(bb[1,1], bb[1,2], bb[2,1], bb[2,2])
outraster <- setExtent(outraster, bb, keepres=TRUE, snap=FALSE)
isInt <- TRUE
Modified: pkg/raster/R/aggold.R
===================================================================
--- pkg/raster/R/aggold.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/aggold.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -38,7 +38,7 @@
outRaster <- raster(x, filename)
dataType(outRaster) <- datatype
- bndbox <- newBbox(xmin(x), xmx, ymn, ymax(x))
+ bndbox <- newExtent(xmin(x), xmx, ymn, ymax(x))
outRaster <- setExtent(outRaster, bndbox, keepres=FALSE)
rowcol(outRaster) <- c(rsteps, csteps)
Modified: pkg/raster/R/aggregate.R
===================================================================
--- pkg/raster/R/aggregate.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/aggregate.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -51,7 +51,7 @@
xmx <- xmin(x) + csteps * xfact * xres(x)
outRaster <- raster(x, filename)
dataType(outRaster) <- datatype
- bndbox <- newBbox(xmin(x), xmx, ymn, ymax(x))
+ bndbox <- newExtent(xmin(x), xmx, ymn, ymax(x))
outRaster <- setExtent(outRaster, bndbox, keepres=FALSE)
rowcol(outRaster) <- c(rsteps, csteps)
Modified: pkg/raster/R/bboxUnion.R
===================================================================
--- pkg/raster/R/bboxUnion.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/bboxUnion.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -5,7 +5,7 @@
# Version 0.8
# Licence GPL v3
-unionBbox <- function(x, ...) {
+unionExtent <- function(x, ...) {
objects <- c(x, list(...))
if (length(objects) == 1) {
return(extent(x))
@@ -21,7 +21,7 @@
return(bb)
}
-intersectBbox <- function(x, ...) {
+intersectExtent <- function(x, ...) {
objects <- c(x, list(...))
if (length(objects) == 1) {
return(extent(x))
Modified: pkg/raster/R/bounding.box.R
===================================================================
--- pkg/raster/R/bounding.box.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/bounding.box.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -8,7 +8,7 @@
-newBbox <- function(xmn, xmx, ymn, ymx) {
+newExtent <- function(xmn, xmx, ymn, ymx) {
bb <- new('BoundingBox')
bb at xmin <- xmn
bb at xmax <- xmx
Modified: pkg/raster/R/cellsFromBbox.R
===================================================================
--- pkg/raster/R/cellsFromBbox.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/cellsFromBbox.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -12,7 +12,7 @@
bndbox <- extent(bndbox)
bndbox <- alignBbox(bndbox, object)
- innerBox <- intersectBbox(extent(object), bndbox)
+ innerBox <- intersectExtent(extent(object), bndbox)
srow <- rowFromY(object, innerBox at ymax)
erow <- rowFromY(object, innerBox at ymin + 0.5 * yres(object))
Modified: pkg/raster/R/crop.R
===================================================================
--- pkg/raster/R/crop.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/crop.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -10,7 +10,7 @@
crop <- function(raster, bndbox, filename="", overwrite=FALSE, filetype='raster', datatype=dataType(raster), track=-1) {
# we could also allow the raster to expand but for now let's not and first make a separate expand function
- bb <- intersectBbox(raster, bndbox)
+ bb <- intersectExtent(raster, bndbox)
bb <- alignBbox(bb, raster)
outraster <- raster(raster, filename)
outraster <- setExtent(outraster, bb, keepres=TRUE)
Modified: pkg/raster/R/dataType.R
===================================================================
--- pkg/raster/R/dataType.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/dataType.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -9,6 +9,7 @@
# for backward compatibility issues and non fatal mistakes.
datatype <- substr( toupper( trim(value) ), 1, 5)
if (datatype=='LOGIC') {datatype <- 'LOG1S'}
+ if (datatype == 'BYTE') {datatype <- 'INT1U'}
if (datatype == 'INTEG') {datatype <- 'INT4S'}
if (datatype == 'NUMER') {datatype <- 'FLT4S'}
if (datatype == 'FLOAT') {datatype <- 'FLT4S'}
@@ -84,7 +85,7 @@
} else {
x at file@datanotation <- 'INT1U'
}
- warning("binary files of a single byte do not have NA values on disk")
+ #warning("binary files of a single byte do not have NA values on disk")
} else if (size == '8') {
if (signed) {
x at file@nodatavalue <- -9223372036854775808
Modified: pkg/raster/R/drawBox.R
===================================================================
--- pkg/raster/R/drawBox.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/drawBox.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -10,7 +10,7 @@
drawBox <- function(show=TRUE, col="red") {
loc <- locator(n=2, type="p")
- bb <- newBbox(min(loc$x), max(loc$x), min(loc$y), max(loc$y))
+ bb <- newExtent(min(loc$x), max(loc$x), min(loc$y), max(loc$y))
if (show) {
p <- rbind(c(bb at xmin, bb at ymin), c(bb at xmin, bb at ymax), c(bb at xmax, bb at ymax), c(bb at xmax, bb at ymin), c(bb at xmin, bb at ymin) )
lines(p, col=col)
Modified: pkg/raster/R/expand.R
===================================================================
--- pkg/raster/R/expand.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/expand.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -25,7 +25,7 @@
ymx <- max(ymx, ymax(raster))
outraster <- raster(raster, filename)
- bndbox <- newBbox(xmn, xmx, ymn, ymx)
+ bndbox <- newExtent(xmn, xmx, ymn, ymx)
outraster <- setExtent(outraster, bndbox, keepres=TRUE)
startrow <- rowFromY(outraster, ymax(raster))
Modified: pkg/raster/R/getBbox.R
===================================================================
--- pkg/raster/R/getBbox.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/getBbox.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -8,23 +8,8 @@
-.bboxmatrix <- function(x) {
- xy <- matrix(NA, nrow=5, ncol=2)
- xy[1,1] <- x at xmin
- xy[1,2] <- x at ymax
- xy[2,1] <- x at xmax
- xy[2,2] <- x at ymax
- xy[3,1] <- x at xmax
- xy[3,2] <- x at ymin
- xy[4,1] <- x at xmin
- xy[4,2] <- x at ymin
- return(xy)
-}
-
-
-
if (!isGeneric("extent")) {
- setGeneric("extent", function(x)
+ setGeneric("extent", function(x, ...)
standardGeneric("extent"))
}
@@ -61,13 +46,15 @@
}
)
-setMethod('extent', signature(x='vector'),
- function(x){
+setMethod('extent', signature(x='numeric'),
+ function(x, ...){
+ dots <- unlist(list(...))
+ x <- c(x, dots)
if (length(x) < 4) {
- stop('vector supplied is too short')
+ stop('insufficient number of elements (should be 4)')
}
if (length(x) > 4) {
- warning('vector supplied is longer then expected (should be 4)')
+ warning('more elements than expected (should be 4)')
}
bb <- new('BoundingBox')
bb at xmin <- x[1]
Modified: pkg/raster/R/plotBbox.R
===================================================================
--- pkg/raster/R/plotBbox.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/plotBbox.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -5,6 +5,7 @@
# Licence GPL v3
+
.bboxmatrix <- function(x) {
xy <- matrix(NA, nrow=5, ncol=2)
xy[1,1] <- x at xmin
@@ -20,7 +21,7 @@
setMethod("plot", signature(x='BoundingBox', y='ANY'),
- function(x, y, add=TRUE, ...) {
+ function(x, y, add=FALSE, ...) {
xy <- .bboxmatrix(x)
xy[5,] <- xy[1,]
if (add) {
Modified: pkg/raster/R/projectRaster.R
===================================================================
--- pkg/raster/R/projectRaster.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/projectRaster.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -15,9 +15,9 @@
res <- .Call("transform", projfrom, projto, nrow(xy), xy[,1], xy[,2], PACKAGE="rgdal")
p <- cbind(res[[1]], res[[2]])
if (any(is.infinite(p[,1])) || any(is.infinite(p[,2]))) {
- stop("non finite transformation detected")
+ stop("non finite transformation detected. This probably means that the map projection chosen is not appropriate for this geographic area")
}
- obj <- raster(newBbox(min(p[,1]), max(p[,1]), min(p[,2]), max(p[,2])), nrows=nrow(object), ncols=ncol(object), proj=(projs))
+ obj <- raster(newExtent(min(p[,1]), max(p[,1]), min(p[,2]), max(p[,2])), nrows=nrow(object), ncols=ncol(object), proj=(projs))
return(obj)
}
@@ -34,7 +34,7 @@
if (projto == "NA") {stop("output projection is NA")}
pbb <- projectExtent(to, projection(from))
- bb <- intersectBbox(pbb, from)
+ bb <- intersectExtent(pbb, from)
validObject(bb)
if (!method %in% c('bilinear', 'ngb')) { stop('invalid method') }
Modified: pkg/raster/R/raster.R
===================================================================
--- pkg/raster/R/raster.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/raster.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -12,7 +12,7 @@
setMethod('raster', signature(x='missing'),
function(nrows=180, ncols=360, xmn=-180, xmx=180, ymn=-90, ymx=90, projs="+proj=longlat +datum=WGS84") {
- bb <- newBbox(xmn, xmx, ymn, ymx)
+ bb <- newExtent(xmn, xmx, ymn, ymx)
r <- raster(bb, nrows=nrows, ncols=ncols, projs=projs)
return(r)
}
Modified: pkg/raster/R/rasterFromCells.R
===================================================================
--- pkg/raster/R/rasterFromCells.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/rasterFromCells.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -14,7 +14,7 @@
x2 <- xFromCol(object, max(cols)) + 0.5 * res[1]
y1 <- yFromRow(object, max(rows)) - 0.5 * res[2]
y2 <- yFromRow(object, min(rows)) + 0.5 * res[2]
- bb <- newBbox(x1, x2, y1, y2)
+ bb <- newExtent(x1, x2, y1, y2)
object <- clearValues(object)
cells2 <- cellsFromBbox(object, bb)
r <- crop(object, bb)
Modified: pkg/raster/R/resample.R
===================================================================
--- pkg/raster/R/resample.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/resample.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -9,7 +9,7 @@
resample <- function(from, to, method="ngb", filename=NULL, filetype='raster', datatype='FLT4S', overwrite=FALSE, track=-1) {
if (!method %in% c('bilinear', 'ngb')) { stop('invalid method') }
- bb <- intersectBbox(from, to)
+ bb <- intersectExtent(from, to)
validObject(bb)
if (is.null(filename)){filename <- ""}
to <- raster(to, filename)
Modified: pkg/raster/R/resolution.R
===================================================================
--- pkg/raster/R/resolution.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/resolution.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -8,24 +8,23 @@
'res<-' <- function(object, value) {
if (length(value) == 1) {
- return( .setRes(object, xres=value, yres=value) )
+ xr=value
+ yr=value
} else {
- return( .setRes(object, xres=value[1], yres=value[2]) )
+ xr=value[1]
+ yr=value[2]
}
-}
-
-
-.setRes <- function(object, xres, yres=xres) {
+
bb <- extent(object)
- nc <- round( (bb at xmax - bb at xmin) / xres )
- nr <- round( (bb at ymax - bb at ymin) / yres )
+ nc <- round( (bb at xmax - bb at xmin) / xr )
+ nr <- round( (bb at ymax - bb at ymin) / yr )
if (nr != object at nrows | nc != object at ncols) {
if (extends(class(object), "Raster")) {
object <- clearValues(object)
}
}
- bb at xmax <- bb at xmin + nc * xres
- bb at ymin <- bb at ymax - nr * yres
+ bb at xmax <- bb at xmin + nc * xr
+ bb at ymin <- bb at ymax - nr * yr
object <- setExtent(object, bb)
rowcol(object) <- c(nr, nc)
return(object)
Modified: pkg/raster/R/setExtent.R
===================================================================
--- pkg/raster/R/setExtent.R 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/R/setExtent.R 2009-05-12 05:31:08 UTC (rev 450)
@@ -6,8 +6,10 @@
# Version 0.8
# Licence GPL v3
+'extent<-' <- function(x, value) {
+ return(setExtent(x, value))
+}
-
setExtent <- function(x, bndbox, keepres=FALSE, snap=FALSE) {
oldbb <- extent(x)
Modified: pkg/raster/man/Compare-methods.Rd
===================================================================
--- pkg/raster/man/Compare-methods.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/Compare-methods.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -29,7 +29,7 @@
as(r1, 'BasicRaster') == as(r2, 'BasicRaster')
r3 <- r1 == r2
-b <- newBbox(0, 360, 0, 180)
+b <- newExtent(0, 360, 0, 180)
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.
Modified: pkg/raster/man/cellsFromBbox.Rd
===================================================================
--- pkg/raster/man/cellsFromBbox.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/cellsFromBbox.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -15,10 +15,10 @@
\arguments{
\item{object}{A Raster* object}
- \item{bndbox}{An object of class BoundingBox (which you can create with newBbox() )}
+ \item{bndbox}{An object of class BoundingBox (which you can create with newExtent() )}
\item{expand}{Logical. If \code{TRUE}, \code{NA} is returned for (virtual) cells implied by \code{bndbox},
that are outside the RasterLayer (\code{object}). If \code{FALSE}, only cell numbers for the area where \code{object} and \code{bndbox}
- overlap are returned (see \link[raster]{intersectBbox}) }
+ overlap are returned (see \link[raster]{intersectExtent}) }
}
\value{
@@ -27,11 +27,11 @@
\author{Robert J. Hijmans}
-\seealso{ \code{\link[raster]{polygonFromBbox}}, \code{\link[raster]{newBbox}}, \code{\link[sp]{SpatialPolygons}} }
+\seealso{ \code{\link[raster]{polygonFromBbox}}, \code{\link[raster]{newExtent}}, \code{\link[sp]{SpatialPolygons}} }
\examples{
r <- raster()
-bb <- newBbox(-10, 10, -20, 20)
+bb <- newExtent(-10, 10, -20, 20)
cells <- cellsFromBbox(r, bb)
}
Modified: pkg/raster/man/crop.Rd
===================================================================
--- pkg/raster/man/crop.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/crop.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -25,7 +25,7 @@
\details{
Objects that have a BoundingBox object include RasterLayer, RasterStack.
They can also be extracted from objects descending from the Spatial class in the sp package.
- You can check this with \code{extent}. New BoundingBox objects can be created with \code{newBbox}.
+ You can check this with \code{extent}. New BoundingBox objects can be created with \code{newExtent}.
If no filename is specified, and the resulting RasterLayer is too large to hold in memory, it is saved to a temporary file.
}
@@ -43,7 +43,7 @@
\examples{
r <- raster(nrow=45, ncol=90)
r[] <- 1:ncell(r)
-bb <- newBbox(-160, 10, 30, 60)
+bb <- newExtent(-160, 10, 30, 60)
rc <- crop(r, bb)
}
Modified: pkg/raster/man/expand.Rd
===================================================================
--- pkg/raster/man/expand.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/expand.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -36,7 +36,7 @@
\examples{
r <- raster(xmn=-150, xmx=-120, ymx=60, ymn=30, ncol=36, nrow=18)
r[] <- 1:ncell(r)
-bb <- newBbox(-180, 0, 0, 90)
+bb <- newExtent(-180, 0, 0, 90)
re <- expand(r, bb)
}
Modified: pkg/raster/man/extent.Rd
===================================================================
--- pkg/raster/man/extent.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/extent.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -5,7 +5,7 @@
\alias{extent,BasicRaster-method}
\alias{extent,Spatial-method}
\alias{extent,matrix-method}
-\alias{extent,vector-method}
+\alias{extent,numeric-method}
\alias{bbox,Raster-method}
@@ -13,17 +13,19 @@
\description{
This function returns the extent, as a BoundingBox object, of a Raster* or Spatial* object (or a BoundingBox object).
-It will also create a BoundingBox object from a matrix (2x2; rows=minx, maxx; cols=miny, maxy) or vector (length=4; order= xmin, xmax, ymin, ymax)
+It will also create a BoundingBox object from a matrix (2x2; rows=minx, maxx; cols=miny, maxy) or
+vector (length=4; order= xmin, xmax, ymin, ymax)
\code{bbox(x)} returns a SP type bbox object (a matrix)
}
\usage{
-extent(x)
+extent(x, ...)
}
\arguments{
- \item{x}{A Raster* or BoundingBox object }
+ \item{x}{A Raster* or BoundingBox object, a matrix, or four numbers }
+ \item{...}{Additional arguments. Only used when x is numeric (to pass three additional numerics) }
}
\value{
@@ -39,8 +41,7 @@
extent(r)
extent(c(0, 20, 0, 20))
#is equivalent to
-newBbox(0, 20, 0, 20)
-
+extent(0, 20, 0, 20)
extent(matrix(c(0, 0, 20, 20), nrow=2))
}
Modified: pkg/raster/man/intersectBbox.Rd
===================================================================
--- pkg/raster/man/intersectBbox.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/intersectBbox.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -1,15 +1,15 @@
-\name{intersectBbox}
+\name{intersectExtent}
-\alias{intersectBbox}
+\alias{intersectExtent}
-\title{BoundingBox intersection}
+\title{BoundingExtent intersection}
\description{
-intersectBbox returns the instersection of multiple bounding boxes
+intersectExtent returns the instersection of multiple bounding boxes
}
\usage{
-intersectBbox(x, ...)
+intersectExtent(x, ...)
}
\arguments{
@@ -23,13 +23,13 @@
\author{Robert J. Hijmans}
-\seealso{ \code{\link[raster]{unionBbox}}, \code{\link[raster]{getBoungingBox}}, \code{\link[raster]{setBoungingBox}} }
+\seealso{ \code{\link[raster]{unionExtent}}, \code{\link[raster]{getBoungingBox}}, \code{\link[raster]{setBoungingBox}} }
\examples{
r <- raster()
-b1 <- newBbox(-10, 10, -20, 20)
-b2 <- newBbox(0, 20, -40, 5)
-i <- intersectBbox(b1, b2)
+b1 <- newExtent(-10, 10, -20, 20)
+b2 <- newExtent(0, 20, -40, 5)
+i <- intersectExtent(b1, b2)
}
\keyword{spatial}
Modified: pkg/raster/man/newBbox.Rd
===================================================================
--- pkg/raster/man/newBbox.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/newBbox.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -1,19 +1,19 @@
-\name{newBbox}
+\name{newExtent}
-\alias{newBbox}
+\alias{newExtent}
\alias{alignBbox}
-\title{create or align a BoundingBox}
+\title{create or align an Extent}
\description{
-newBbox creates a new BoundingBox object
+newExtent creates a new Extent object
alignBbox aligns a bounding box with the cells of a Raster* object
}
\usage{
-newBbox(xmn, xmx, ymn, ymx)
+newExtent(xmn, xmx, ymn, ymx)
alignBbox(bndbox, object)
}
@@ -22,7 +22,7 @@
\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{bndbox}{An object of class BoundingBox (which you can create with newExtent() )}
\item{object}{A Raster* object}
}
@@ -36,7 +36,7 @@
\examples{
r <- raster()
-bb <- newBbox(-10.1, 10.1, -20.1, 20.1)
+bb <- newExtent(-10.1, 10.1, -20.1, 20.1)
bba <- alignBbox(bb, r)
bb
extent(r)
Modified: pkg/raster/man/polygonFromBbox.Rd
===================================================================
--- pkg/raster/man/polygonFromBbox.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/polygonFromBbox.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -13,7 +13,7 @@
}
\arguments{
- \item{bndbox}{An object of class BoundingBox (which you can create with newBbox() )}
+ \item{bndbox}{An object of class BoundingBox (which you can create with newExtent() )}
\item{sp}{logical. If \code{TRUE}, the output will be a SpatialPolygons object (sp package). Otherwise a matrix of coordinates is returned}
}
@@ -23,7 +23,7 @@
\author{Robert J. Hijmans}
-\seealso{ \code{\link[raster]{cellsFromBbox}}, \code{\link[raster]{newBbox}}, \code{\link[sp]{SpatialPolygons}} }
+\seealso{ \code{\link[raster]{cellsFromBbox}}, \code{\link[raster]{newExtent}}, \code{\link[sp]{SpatialPolygons}} }
\examples{
r <- raster()
Modified: pkg/raster/man/setExtent.Rd
===================================================================
--- pkg/raster/man/setExtent.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/setExtent.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -1,6 +1,7 @@
\name{setExtent}
\alias{setExtent}
+\alias{extent<-}
\title{Set the extent of a RasteLayer}
@@ -11,13 +12,15 @@
\usage{
setExtent(x, bndbox, keepres=FALSE, snap=FALSE)
+extent(x) <- value
}
\arguments{
\item{x}{A Raster* object}
- \item{bndbox}{An object of class BoundingBox (which you can create with newBbox() )}
+ \item{bndbox}{An object of class BoundingBox (which you can create with \code{\link[raster]{extent}} )}
\item{keepres}{logical. If \code{TRUE}, the resolution of the cells will stay the same after adjusting the bounding box (see Details)}
\item{snap}{logical. If \code{TRUE}, the extent is adjusted so that the cells of the input and output RasterLayer are aligned}
+ \item{value}{An object of class BoundingBox (which you can create with \code{\link[raster]{extent}} )}
}
\details{
@@ -34,12 +37,14 @@
\author{Robert J. Hijmans}
-\seealso{ \code{\link[raster]{BoungingBox-class}} }
+\seealso{ \code{\link[raster]{extent}}, \code{\link[raster]{BoungingBox-class}} }
\examples{
r <- raster()
-bb <- newBbox(-10, 10, -20, 20)
+bb <- extent(-10, 10, -20, 20)
+extent(r) <- bb
r <- setExtent(r, bb, keepres=TRUE)
+
}
\keyword{spatial}
Modified: pkg/raster/man/unionBbox.Rd
===================================================================
--- pkg/raster/man/unionBbox.Rd 2009-05-08 15:48:13 UTC (rev 449)
+++ pkg/raster/man/unionBbox.Rd 2009-05-12 05:31:08 UTC (rev 450)
@@ -1,15 +1,15 @@
-\name{unionBbox}
+\name{unionExtent}
-\alias{unionBbox}
+\alias{unionExtent}
\title{BoundingBox union}
\description{
-unionBbox returns the union of multiple bounding boxes
+unionExtent returns the union of multiple bounding boxes
}
\usage{
-unionBbox(x, ...)
+unionExtent(x, ...)
}
\arguments{
@@ -27,9 +27,9 @@
\examples{
r <- raster()
-b1 <- newBbox(-10, 10, -20, 20)
-b2 <- newBbox(0, 20, -40, 5)
-u <- unionBbox(b1, b2)
+b1 <- newExtent(-10, 10, -20, 20)
+b2 <- newExtent(0, 20, -40, 5)
+u <- unionExtent(b1, b2)
}
\keyword{spatial}
More information about the Raster-commits
mailing list