Given a tessellation and a list of spatial points, determine which tile of the tessellation contains each of the given points.
tileindex(x, y, Z, close.gaps=TRUE, all.inside=FALSE)A factor, of the same length as x and y,
whose levels are the names of the tiles of Z.
The factor values may include NA unless all.inside=TRUE
was specified.
Spatial coordinates.
Numeric vectors of equal length.
(Alternatively y may be missing
and x may be an object containing
spatial coordinates).
A tessellation (object of class "tess").
Logical value specifying whether all points \(x,y\)
lying inside the window of Z must be classified
as belonging to a tile. This avoids the effect of numerical errors
in the tile geometry. See Details.
Logical value specifying whether all points \(x,y\) should be classified as lying inside a tile. This implies that points lying outside the window will be assigned to the closest tile. See Details.
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk
This function determines which tile of the tessellation Z
contains each of the spatial points
with coordinates (x[i],y[i]).
The result is a factor, of the same length as x and y,
indicating which tile contains each point. The levels of the factor
are the names of the tiles of Z.
A point lying outside the window containing the tessellation
is assigned the value NA by default.
However if all.inside=TRUE is specified,
then every point will be assigned to
the closest tile, and no NA values are returned.
It is possible that, due to numerical error, a point lying inside the
window may not be classified as belonging to any of the tiles of
Z. If this occurs, the default behaviour is to assign
the point to the closest tile. This can be suppressed
by setting close.gaps=FALSE (and all.inside=FALSE);
in that case, NA values are returned for such points.
cut.ppp and split.ppp to
divide up the points of a point pattern according to
a tessellation.
as.function.tess to create a function whose
value is the tile index.
X <- runifrect(7)
V <- dirichlet(X)
tileindex(0.1, 0.4, V)
tileindex(list(x=0.1, y=0.4), Z=V)
tileindex(X, Z=V)
Run the code above in your browser using DataLab