[Raster-commits] r208 - in pkg/raster: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 29 07:32:28 CET 2009
Author: rhijmans
Date: 2009-01-29 07:32:28 +0100 (Thu, 29 Jan 2009)
New Revision: 208
Modified:
pkg/raster/DESCRIPTION
pkg/raster/R/raster.create.R
pkg/raster/R/set.values.R
pkg/raster/man/create.raster.Rd
Log:
Modified: pkg/raster/DESCRIPTION
===================================================================
--- pkg/raster/DESCRIPTION 2009-01-29 05:55:38 UTC (rev 207)
+++ pkg/raster/DESCRIPTION 2009-01-29 06:32:28 UTC (rev 208)
@@ -1,8 +1,8 @@
Package: raster
Type: Package
Title: Raster data handling for geographic data analysis and modeling
-Version: 0.8.7-3
-Date: 29-Jan-2009
+Version: 0.8.7-4
+Date: 30-Jan-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/raster.create.R
===================================================================
--- pkg/raster/R/raster.create.R 2009-01-29 05:55:38 UTC (rev 207)
+++ pkg/raster/R/raster.create.R 2009-01-29 06:32:28 UTC (rev 208)
@@ -19,16 +19,27 @@
newRaster <- function(xmn=-180, xmx=180, ymn=-90, ymx=90, nrows=180, ncols=360, projstring="+proj=longlat +datum=WGS84") {
bb <- newBbox(xmn, xmx, ymn, ymx)
- return(rasterFromBbox(bb, nrows=nrows, ncols=ncols, projstring))
+ rs <- rasterFromBbox(bb, nrows=nrows, ncols=ncols)
+ rs <- setProjection(rs, projstring)
+ return(rs)
}
-rasterFromBbox <- function(bndbox, nrows=1, ncols=1, projstring="") {
+
+
+#if (!isGeneric("values")) {
+# setGeneric("values", function(object, ...)
+# standardGeneric("values"))
+#}
+
+#setMethod('values', signature(object='Raster'),
+rasterFromBbox <- function(bndbox, nrows=1, ncols=1) {
+ crs <- newCRS('NA')
+ try(crs <- projection(bndbox, asText=F), silent = T)
bndbox <- getBbox(bndbox)
nr = as.integer(round(nrows))
nc = as.integer(round(ncols))
if (nc < 1) { stop("ncols should be > 0") }
if (nr < 1) { stop("nrows should be > 0") }
- crs <- newCRS(projstring)
raster <- new("RasterLayer", bbox = bndbox, crs=crs, ncols = nc, nrows = nr )
return(raster)
}
Modified: pkg/raster/R/set.values.R
===================================================================
--- pkg/raster/R/set.values.R 2009-01-29 05:55:38 UTC (rev 207)
+++ pkg/raster/R/set.values.R 2009-01-29 06:32:28 UTC (rev 208)
@@ -81,7 +81,7 @@
return(raster)
} else {
# as above, but by reading data from disk, row by row
- stop('not implemented yet, use readAll() first' )
+ stop('not implemented yet for objects with no data in memory, use readAll() first' )
}
}
}
Modified: pkg/raster/man/create.raster.Rd
===================================================================
--- pkg/raster/man/create.raster.Rd 2009-01-29 05:55:38 UTC (rev 207)
+++ pkg/raster/man/create.raster.Rd 2009-01-29 06:32:28 UTC (rev 208)
@@ -12,7 +12,7 @@
}
\usage{
newRaster(xmn = -180, xmx = 180, ymn = -90, ymx = 90, nrows = 180, ncols = 360, projstring = "+proj=longlat +datum=WGS84")
- rasterFromBbox(bndbox, nrows = 1, ncols = 1, projstring="")
+ rasterFromBbox(bndbox, nrows = 1, ncols = 1)
rasterFromFile(filename, values=FALSE, band=1)
closeHandle(raster)
}
More information about the Raster-commits
mailing list