\HeaderA{overlay-methods}{Methods for spatially overlay-ing points (grids) and rings layers}{overlay.Rdash.methods}
\aliasA{overlay,SpatialGrid,SpatialPoints-method}{overlay-methods}{overlay,SpatialGrid,SpatialPoints.Rdash.method}
\aliasA{overlay,SpatialGridDataFrame,SpatialPoints-method}{overlay-methods}{overlay,SpatialGridDataFrame,SpatialPoints.Rdash.method}
\aliasA{overlay,SpatialPixels,SpatialPoints-method}{overlay-methods}{overlay,SpatialPixels,SpatialPoints.Rdash.method}
\aliasA{overlay,SpatialPixelsDataFrame,SpatialPoints-method}{overlay-methods}{overlay,SpatialPixelsDataFrame,SpatialPoints.Rdash.method}
\aliasA{overlay,SpatialPoints,SpatialPolygons-method}{overlay-methods}{overlay,SpatialPoints,SpatialPolygons.Rdash.method}
\aliasA{overlay,SpatialPointsDataFrame,SpatialPolygons-method}{overlay-methods}{overlay,SpatialPointsDataFrame,SpatialPolygons.Rdash.method}
\aliasA{overlay,SpatialPolygons,SpatialPoints-method}{overlay-methods}{overlay,SpatialPolygons,SpatialPoints.Rdash.method}
\keyword{methods}{overlay-methods}
\begin{Description}\relax
overlay combines points (or grids) and rings by performing point-in-polygon
operation on all point-ring combinations.
\end{Description}
\begin{Section}{Methods}
\describe{
\item[x = "SpatialPoints", y = "SpatialPolygons"] returns a numeric vector of length
equal to the number of points; the number is the id (number) of the ring of \code{y}
in which a point falls; NA denotes the point does not fall in a ring; if a point
falls in multiple rings, the last ring is recorded. 

\item[x = "SpatialPointsDataFrame", y = "SpatialPolygons"] equal to the previous method,
except that an argument \code{fn=xxx} is allowed, e.g. \code{fn = mean} which will 
then report a data.frame with the mean values of the \code{x} points fallin in each
ring (set) of \code{y} 
\item[x = "SpatialPolygons", y = "SpatialPoints"] returns the ring id of points in \code{y};
if \code{x} is a \code{SpatialRingDataFrame}, a data.frame with rows from \code{x}
corresponding to ponits in \code{y} is returned.
\item[x = "SpatialGridDataFrame", y = "SpatialPoints"] returns object of class
SpatialPointsDataFrame with grid attribute values x at spatial
point locations y; NA for NA grid cells or points outside grid, and NA values
on NA grid cells. 
\item[x = "SpatialGrid", y = "SpatialPoints"] returns grid values x at spatial
point locations y; NA for NA grid cells or points outside the grid 
\item[x = "SpatialPixelsDataFrame", y = "SpatialPoints"] returns grid values x at 
spatial point locations y; NA for NA grid cells or points outside the grid 
\item[x = "SpatialPixels", y = "SpatialPoints"] returns grid values x at spatial
point locations y; NA for NA grid cells or points outside the grid 

}
\end{Section}
\begin{Note}\relax
points on a ring boundary and points corresponding to a ring vertex are
considered to be inside the ring
\end{Note}
\begin{Author}\relax
Edzer J. Pebesma, \email{e.pebesma@geo.uu.nl}
\end{Author}
\begin{SeeAlso}\relax
\LinkA{overlay}{overlay}, \LinkA{point.in.polygon}{point.in.polygon}
\end{SeeAlso}

