\HeaderA{image.SpatialGridDataFrame}{image gridded spatial data, or convert to format for image}{image.SpatialGridDataFrame}
\aliasA{as.image.SpatialGridDataFrame}{image.SpatialGridDataFrame}{as.image.SpatialGridDataFrame}
\keyword{spatial}{image.SpatialGridDataFrame}
\begin{Description}\relax
Convert gridded data in SpatialGridDataFrame to image format; call
image on data in SpatialGridDataFrame format
\end{Description}
\begin{Usage}
\begin{verbatim}
image.SpatialGridDataFrame(x, attr = 1, xcol = 1, ycol = 2, asp = 1, axes = FALSE, ...)
as.image.SpatialGridDataFrame(x, xcol = 1, ycol = 2)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] object of class \LinkA{SpatialGridDataFrame}{SpatialGridDataFrame} 
\item[\code{attr}] column number of attribute variable; this may be
the column name in the data.frame of \code{data} (as.data.frame(data)), or
a column number 
\item[\code{xcol}] column number of x-coordinate, in the coordinate matrix 
\item[\code{ycol}] column number of y-coordinate, in the coordinate matrix 
\item[\code{asp}] aspect ratio of unit x and unit y axis 
\item[\code{axes}] logical; should coordinate axes be drawn? 
\item[\code{...}] arguments passed to \LinkA{image}{image}, see examples 
\end{ldescription}
\end{Arguments}
\begin{Value}
\code{as.image.SpatialGridDataFrame} returns the list with
elements \code{x} and \code{y}, containing the coordinates of the cell
centres of a matrix \code{z}, containing the attribute values in matrix
form as needed by \LinkA{image}{image}.
\end{Value}
\begin{Note}\relax
Providing \code{xcol} and \code{ycol} attributes seems obsolete,
and it is for 2D data, but it may provide opportunities for plotting
certain slices in 3D data. I haven't given this much thought yet.

\LinkA{filled.contour}{filled.contour} seems to misinterpret the coordinate values,
if we take the image.default manual page as the reference.
\end{Note}
\begin{Author}\relax
Edzer J. Pebesma
\end{Author}
\begin{References}\relax
\end{References}
\begin{SeeAlso}\relax
\LinkA{image.default}{image.default}, \LinkA{SpatialGridDataFrame-class}{SpatialGridDataFrame.Rdash.class},
\LinkA{levelplot}{levelplot} in package \code{lattice}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(meuse.grid)
coordinates(meuse.grid) = c("x", "y") # promote to SpatialPointsDataFrame
gridded(meuse.grid) = TRUE            # promote to SpatialGridDataFrame
image(meuse.grid["dist"], main = "Distance to river Meuse")
data(meuse)
coordinates(meuse) = c("x", "y")
points(coordinates(meuse), pch = "+")
\end{ExampleCode}
\end{Examples}

