1# Author: Robert J. Hijmans
2# Date :  March  2009, August 2012
3# Licence GPL v3
4# updated November 2011
5# version 1.0
6
7
8fourCellsFromXY <- function(object, xy, duplicates=TRUE) {
9# if duplicates is TRUE, the same cell number can be returned
10# twice (if point in the middle of division between two cells) or
11# four times (if point in center of cell)
12	r <- raster(object) # use small object
13	stopifnot(is.matrix(xy))
14	return( .doFourCellsFromXY(r@ncols, r@nrows, xmin(r), xmax(r), ymin(r), ymax(r), xy, duplicates, .isGlobalLonLat(r)))
15}
16