[Raster-commits] r141 - pkg/raster/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 15 18:23:46 CET 2009
Author: rhijmans
Date: 2009-01-15 18:23:46 +0100 (Thu, 15 Jan 2009)
New Revision: 141
Modified:
pkg/raster/R/click.R
Log:
Modified: pkg/raster/R/click.R
===================================================================
--- pkg/raster/R/click.R 2009-01-15 17:12:57 UTC (rev 140)
+++ pkg/raster/R/click.R 2009-01-15 17:23:46 UTC (rev 141)
@@ -12,17 +12,21 @@
loc <- locator(n)
x <- loc$x
y <- loc$y
- xy <- cbind(x, y)
+ xyCoords <- cbind(x, y)
if (dataContent(object) != 'all') {
if (dataSource(object) != 'disk') {
stop('no data associated with this RasterLayer object')
} else {
- return(xyValues(object, xy))
+ return(xyValues(object, xyCoords))
}
} else {
- cell <- cellFromXY(object, xy)
+ cell <- cellFromXY(object, xyCoords)
value <- values(object)[cell]
- return(cbind(xy, value))
+ if (xy) {
+ return(cbind(xyCoords, value))
+ } else {
+ return(value)
+ }
}
}
More information about the Raster-commits
mailing list