| 1 |
\name{coordinates} |
| 2 |
\alias{coordinates} |
| 3 |
\alias{coordinates<-} |
| 4 |
|
| 5 |
\title{ set spatial coordinates to create a Spatial object, or retrieve |
| 6 |
spatial coordinates from a Spatial object} |
| 7 |
\description{ set spatial coordinates to create a Spatial object, or retrieve |
| 8 |
spatial coordinates from a Spatial object} |
| 9 |
\usage{ |
| 10 |
coordinates(obj, ...) |
| 11 |
coordinates(object) <- value |
| 12 |
} |
| 13 |
\arguments{ |
| 14 |
\item{obj}{ object deriving from class "Spatial" } |
| 15 |
\item{object}{ object of class "data.frame" } |
| 16 |
\item{value}{ spatial coordinates; either a matrix, list, or data |
| 17 |
frame with numeric data, or column names, column number or a |
| 18 |
reference: a formula (in the form of e.g. \code{~x+y}), column numbers |
| 19 |
(e.g. \code{c(1,2)}) or column names (e.g. \code{c("x","y")}) specifying |
| 20 |
which columns in \code{object} are the spatial coordinates. If the coordinates |
| 21 |
are part of object, giving the reference does not duplicate them, giving |
| 22 |
their value does duplicate them in the resulting structure. |
| 23 |
} |
| 24 |
\item{...}{additional arguments that may be used by particular methods} |
| 25 |
} |
| 26 |
\value{ usually an object of class SpatialPointsDataFrame; if the coordinates |
| 27 |
set cover the full set of variables in object, an object of class SpatialPoints |
| 28 |
is returned } |
| 29 |
\examples{ |
| 30 |
# data.frame |
| 31 |
data(meuse.grid) |
| 32 |
coordinates(meuse.grid) <- ~x+y |
| 33 |
gridded(meuse.grid) <- TRUE |
| 34 |
class(meuse.grid) |
| 35 |
bbox(meuse.grid) |
| 36 |
|
| 37 |
data(meuse) |
| 38 |
meuse.xy = meuse[c("x", "y")] |
| 39 |
coordinates(meuse.xy) <- ~x+y |
| 40 |
class(meuse.xy) |
| 41 |
|
| 42 |
} |
| 43 |
\keyword{manip} |