\HeaderA{SpatialPixels}{define spatial grid}{SpatialPixels}
\aliasA{areaSpatialGrid}{SpatialPixels}{areaSpatialGrid}
\aliasA{coordinatevalues}{SpatialPixels}{coordinatevalues}
\aliasA{getGridIndex}{SpatialPixels}{getGridIndex}
\aliasA{getGridTopology}{SpatialPixels}{getGridTopology}
\aliasA{GridTopology}{SpatialPixels}{GridTopology}
\aliasA{plot.SpatialGrid}{SpatialPixels}{plot.SpatialGrid}
\aliasA{points2grid}{SpatialPixels}{points2grid}
\aliasA{SpatialGrid}{SpatialPixels}{SpatialGrid}
\methaliasA{SpatialGrid}{SpatialPixels}{SpatialGrid}
\keyword{spatial}{SpatialPixels}
\begin{Description}\relax
defines spatial grid by offset, cell size and dimensions
\end{Description}
\begin{Usage}
\begin{verbatim}
GridTopology(cellcentre.offset, cellsize, cells.dim)
SpatialPixels(points, tolerance = 10 * .Machine$double.eps)
SpatialGrid(grid, proj4string = CRS(as.character(NA)))
coordinatevalues(obj)
points2grid(points, tolerance)
getGridIndex(cc, grid, all.inside = TRUE)
getGridTopology(obj)
areaSpatialGrid(obj)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{cellcentre.offset}] numeric; vector with the smallest coordinates for
each dimension
\item[\code{cellsize}] numeric; vector with the cell size in each dimension
\item[\code{cells.dim}] integer; vector with number of cells in each dimension
\item[\code{points}] coordinates, object of class \LinkA{SpatialPoints-class}{SpatialPoints.Rdash.class} 
\item[\code{grid}] grid topology; object of class \LinkA{GridTopology-class}{GridTopology.Rdash.class}
\item[\code{tolerance}] precision, used to which extent points are exactly on
a grid
\item[\code{proj4string}] object of class \LinkA{CRS-class}{CRS.Rdash.class}
\item[\code{obj}] object of class or deriving from \LinkA{SpatialGrid-class}{SpatialGrid.Rdash.class}
\item[\code{cc}] numeric matrix with coordinates 
\item[\code{all.inside}] logical; if TRUE and \code{cc} points fall outside
the grid area, an error message is generated; if FALSE, NA values
are generated for such points 
\end{ldescription}
\end{Arguments}
\begin{Value}
GridTopology returns a value of class \LinkA{GridTopology-class}{GridTopology.Rdash.class};
SpatialGrid returns an object of class \LinkA{SpatialGrid-class}{SpatialGrid.Rdash.class}

\code{coordinatevalues} returns a list with the unique x-coordinates,
the unique y-coordinate, etc. instead of the \LinkA{coordinates}{coordinates} of all
grid cells

SpatialGrid returns an object of class \LinkA{SpatialGrid-class}{SpatialGrid.Rdash.class}. 

points2grid returns the \LinkA{GridTopology-class}{GridTopology.Rdash.class} from a set of points.

getGridIndex finds the index of a set of point coordinates in a given
grid topology, and depending on \code{all.inside} setting, generates NA
or an error message if points are outside the grid domain.

getGridTopology returns the slot of class \LinkA{GridTopology-class}{GridTopology.Rdash.class} from
obj.

areaSpatialGrid returns the spatial area of (the non-missing valued cells
of) the grid. For objects of class \LinkA{SpatialGridDataFrame-class}{SpatialGridDataFrame.Rdash.class}
the area refers to cells where any (one or more) of the attribute columns
are non-missing valued.
\end{Value}
\begin{Note}\relax
SpatialGrid stores grid topology and may or may not store the coordinates
of the actual points, which may form a subset of the full grid. To find
out or change this, see \LinkA{fullgrid}{fullgrid}.
\end{Note}
\begin{Author}\relax
Edzer J. Pebesma, \email{e.pebesma@geo.uu.nl}
\end{Author}
\begin{References}\relax
\end{References}
\begin{SeeAlso}\relax
\LinkA{SpatialGrid-class}{SpatialGrid.Rdash.class},
\LinkA{SpatialGridDataFrame-class}{SpatialGridDataFrame.Rdash.class},
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
x = GridTopology(c(0,0), c(1,1), c(5,4))
class(x)
x
summary(x)
coordinates(x)
coordinates(GridTopology(c(0,0), c(1,1), c(5,4)))
coordinatevalues(x)
\end{ExampleCode}
\end{Examples}

