nearest.raster.point(x,y,w, indices=TRUE)
"owin"
)
of type "mask"
representing a binary pixel image.indices=TRUE
, a
list containing two vectors rr
and cc
giving row and column positions (in the image matrix).
If indices=FALSE
, a list containing
vectors x
and y
giving actual coordinates
of the pixels.w
should be a window (an object of class
"owin"
, see owin.object
for details)
of type "mask"
. This represents a binary pixel image. The arguments x
and y
should be numeric vectors
of equal length. They are interpreted as the coordinates of
points in space. For each point (x[i], y[i])
, the function
finds the nearest pixel in the grid of pixels for w
.
If indices=TRUE
,
this function returns a list containing two vectors rr
and
cc
giving row and column positions (in the image matrix).
For the location (x[i],y[i])
the nearest
pixel is at row rr[i]
and column cc[i]
of
the image.
If indices=FALSE
, the function returns a list containing
two vectors x
and y
giving the actual coordinates
of the pixels.
owin.object
,
as.mask
w <- owin(c(0,1), c(0,1), mask=matrix(TRUE, 100,100)) # 100 x 100 grid
nearest.raster.point(0.5, 0.3, w)
nearest.raster.point(0.5, 0.3, w, indices=FALSE)
Run the code above in your browser using DataLab