\HeaderA{as.SpatialPolygons.GridTopology}{Make SpatialPolygons object from GridTopology object}{as.SpatialPolygons.GridTopology}
\aliasA{IDvaluesGridTopology}{as.SpatialPolygons.GridTopology}{IDvaluesGridTopology}
\keyword{spatial}{as.SpatialPolygons.GridTopology}
\begin{Description}\relax
Converts grids of regular rectangles into a \code{SpatialPolygons} object, which can be transformed to a different projection or datum. The function is not suitable for high-resolution grids. The ordering of the grid cells is as in \code{coordinates()} of the same object, and is reported by \code{IDvaluesGridTopology}.
\end{Description}
\begin{Usage}
\begin{verbatim}
as.SpatialPolygons.GridTopology(grd, proj4string = CRS(as.character(NA)))
IDvaluesGridTopology(obj)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{grd,obj}] \code{GridTopology} object
\item[\code{proj4string}] projection string of class CRS
\end{ldescription}
\end{Arguments}
\begin{Value}
\code{as.SpatialPolygons.GridTopology} returns a \code{SpatialPolygons} object;
\code{IDvaluesGridTopology} returns a character vector with the \code{GridTopology} object column and row indices.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{GridTopology}{GridTopology}}, \code{\LinkA{SpatialPolygons}{SpatialPolygons}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
grd <- GridTopology(cellcentre.offset=c(-175,55), cellsize=c(10,10), cells.dim=c(4,4))
SpP_grd <- as.SpatialPolygons.GridTopology(grd)
plot(SpP_grd)
text(getSpPPolygonsLabptSlots(SpP_grd), getSpPPolygonsIDSlots(SpP_grd), cex=0.5)
trdata <- data.frame(A=rep(c(1,2,3,4), 4), B=rep(c(1,2,3,4), each=4), row.names=getSpPPolygonsIDSlots(SpP_grd))
SpPDF <- SpatialPolygonsDataFrame(SpP_grd, trdata)
spplot(SpPDF)
\end{ExampleCode}
\end{Examples}

