| 1 |
\name{SpatialPixelsDataFrame-class} |
| 2 |
\docType{class} |
| 3 |
\alias{SpatialPixelsDataFrame-class} |
| 4 |
\alias{[,SpatialPixelsDataFrame-method} |
| 5 |
\alias{show,SpatialPixelsDataFrame-method} |
| 6 |
% \alias{SpatialPixelsDataFrame} |
| 7 |
\alias{plot.SpatialPixelsDataFrame} |
| 8 |
\alias{print.summary.SpatialPixelsDataFrame} |
| 9 |
\alias{coerce,SpatialPixelsDataFrame,SpatialPointsDataFrame-method} |
| 10 |
\alias{coerce,SpatialPixelsDataFrame,SpatialGridDataFrame-method} |
| 11 |
\alias{coerce,SpatialPixelsDataFrame,SpatialPolygonsDataFrame-method} |
| 12 |
\alias{coerce,SpatialPixelsDataFrame,data.frame-method} |
| 13 |
\alias{coerce,SpatialPixelsDataFrame,matrix-method} |
| 14 |
\alias{coerce,SpatialPixelsDataFrame,array-method} |
| 15 |
\alias{as.data.frame.SpatialPixelsDataFrame} |
| 16 |
\alias{rbind.SpatialPixelsDataFrame} |
| 17 |
\alias{dim.SpatialPixelsDataFrame} |
| 18 |
\alias{plot,SpatialPixelsDataFrame,missing-method} |
| 19 |
|
| 20 |
\title{Class "SpatialPixelsDataFrame" } |
| 21 |
\description{ Class for spatial attributes that have spatial locations |
| 22 |
on a regular grid. } |
| 23 |
\section{Objects from the Class}{ |
| 24 |
Objects can be created by calls of the form \code{as(x, |
| 25 |
"SpatialPixelsDataFrame")}, where \code{x} is of class |
| 26 |
\link{SpatialPointsDataFrame-class}, or by importing through rgdal. |
| 27 |
Ordered full grids are stored instead or unordered non-NA cells; |
| 28 |
} |
| 29 |
|
| 30 |
\section{Slots}{ |
| 31 |
\describe{ |
| 32 |
\item{\code{bbox}:}{Object of class \code{"matrix"}; bounding box } |
| 33 |
\item{\code{proj4string}:}{Object of class \code{"CRS"}; projection } |
| 34 |
\item{\code{coords}:}{see \link{SpatialPoints}; points slot } |
| 35 |
\item{\code{coords.nrs}}{see \link{SpatialPointsDataFrame}} |
| 36 |
\item{\code{grid}:}{see \link{GridTopology-class}; grid parameters } |
| 37 |
\item{\code{grid.index}:}{integer; index of points in the list to points |
| 38 |
in the full (ordered) grid. x cycles fastest; all coordinates increase |
| 39 |
from low to hight except y, which decreases from high to low } |
| 40 |
\item{\code{data}:}{Object of class data.frame, containing the attribute data } |
| 41 |
} |
| 42 |
} |
| 43 |
\section{Extends}{ |
| 44 |
Class \code{"SpatialPixels"}, directly. |
| 45 |
Class \code{"Spatial"}, by class \code{"SpatialPixels"}. |
| 46 |
} |
| 47 |
\section{Methods}{ |
| 48 |
\describe{ |
| 49 |
\item{coordinates}{\code{signature(x = "SpatialPixelsDataFrame")}: retrieves coordinates } |
| 50 |
\item{[}{\code{signature(x = "SpatialPixelsDataFrame")}: selects row(s) and/or attribute(s), and returns an |
| 51 |
object of class \code{SpatialPixelsDataFrame}; rows refer here to the pixel |
| 52 |
numbers, not grid lines. For selecting a square block in a grid, coerce to |
| 53 |
a \link{SpatialGridDataFrame-class} first, and use \code{[} on that object} |
| 54 |
\item{as.matrix}{\code{signature(x = "SpatialPixelsDataFrame")}: coerce to matrix } |
| 55 |
\item{rbind}{\code{signature(x = "SpatialPixelsDataFrame")}: rbind-like method } |
| 56 |
\item{plot}{\code{signature(x = "SpatialPixelsDataFrame", y = "missing")}: see |
| 57 |
\link{SpatialGridDataFrame-class} for details} |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
\author{ Edzer Pebesma, \email{[email protected]} } |
| 62 |
|
| 63 |
\seealso{ |
| 64 |
\code{\link{SpatialPixels-class}}, which does not contain the attribute data |
| 65 |
} |
| 66 |
\examples{ |
| 67 |
data(meuse.grid) # only the non-missing valued cells |
| 68 |
coordinates(meuse.grid) = c("x", "y") # promote to SpatialPointsDataFrame |
| 69 |
gridded(meuse.grid) <- TRUE # promote to SpatialPixelsDataFrame |
| 70 |
meuse.grid[["idist"]] = 1 - meuse.grid[["dist"]] # assigns new attribute |
| 71 |
image(meuse.grid["idist"]) # note the single [ |
| 72 |
|
| 73 |
# toy example: |
| 74 |
df = data.frame(z = c(1:6,NA,8,9), |
| 75 |
xc = c(1,1,1,2,2,2,3,3,3), |
| 76 |
yc = c(rep(c(0, 1.5, 3),3))) |
| 77 |
coordinates(df) = ~xc+yc |
| 78 |
gridded(df) = TRUE |
| 79 |
image(df["z"]) |
| 80 |
# draw labels to verify: |
| 81 |
cc = coordinates(df) |
| 82 |
z=df[["z"]] |
| 83 |
zc=as.character(z) |
| 84 |
zc[is.na(zc)]="NA" |
| 85 |
text(cc[,1],cc[,2],zc) |
| 86 |
|
| 87 |
} |
| 88 |
\keyword{classes} |