This function builds a rectangular grid and extracts points which are
inside of an internal polygonal region.
Usage
polygrid(xgrid, ygrid, poly, vec.inout = FALSE)
Arguments
xgrid
grid values in the x-direction.
ygrid
grid values in the y-direction.
poly
a matrix with the polygon coordinates.
vec.inout
logical. If TRUE a logical vector is included
in the output indicating whether each point of the grid is inside
the polygon. Defaults to FALSE.
Value
A list with components:
xypolyan $n \times 2$ matrix with the coordinates of the points inside the polygon.
vec.inoutlogical, a vector indicating whether each point of
the rectangular grid is inside the polygon. Only returned if vec.inout =
TRUE.
Details
This function requires the package splancs.
The function works as follows:
First it creates a grid using the Rfunction
expand.grid and then it uses the function
inout from the package splancs to extract the points
of the grid which are inside the polygon.
Within the package geoR
this function is typically used to select points in a non-rectangular
region to perform spatial prediction
using krige.bayes, krige.conv or
ksline. It is also useful to produce
image or perspective plots of the prediction results.
References
Further information about geoR can be found at:
http://www.maths.lancs.ac.uk/~ribeiro/geoR.html.