[Raster-commits] r321 - pkg/raster/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Mar 7 10:51:43 CET 2009
Author: rhijmans
Date: 2009-03-07 10:51:43 +0100 (Sat, 07 Mar 2009)
New Revision: 321
Modified:
pkg/raster/R/bilinearValue.R
Log:
Modified: pkg/raster/R/bilinearValue.R
===================================================================
--- pkg/raster/R/bilinearValue.R 2009-03-07 09:20:02 UTC (rev 320)
+++ pkg/raster/R/bilinearValue.R 2009-03-07 09:51:43 UTC (rev 321)
@@ -12,17 +12,16 @@
cellsXY <- xyFromCell(raster, cells)
pos <- matrix(-1, ncol=ncol(xy), nrow=nrow(xy))
- pos[xy[,1] > cellsXY[,1]] <- 1
- pos[xy[,2] < cellsXY[,2]] <- 1
+ pos[ xy[,1] > cellsXY[,1] ] <- 1
+ pos[ xy[,2] < cellsXY[,2] ] <- 1
poscol <- col + pos[,1]
poscol[poscol==0] <- 2
- poscol[poscol==nrow(raster)+1] <- nrow(raster) - 1
+ poscol[poscol==ncol(raster)+1] <- ncol(raster) - 1
posrow <- row + pos[,2]
posrow[posrow==0] <- 2
- posrow[posrow==ncol(raster)+1] <- ncol(raster) - 1
+ posrow[posrow==nrow(raster)+1] <- nrow(raster) - 1
-
four <- matrix(ncol=4, nrow=nrow(xy))
four[,1] <- cells
four[,2] <- cellFromRowCol(raster, posrow, col)
More information about the Raster-commits
mailing list