geometry retrieves the SpatialXxx object from a SpatialXxxDataFrame object, with Xxx Lines, Points, Polygons, Grid, or Pixels. geometry<- converts a data.frame into a Spatial object.
geometry(obj)
geometry(obj) <- value
in case of assignment, a data.frame, else an object of class Spatial
object of class Spatial
Edzer Pebesma, edzer.pebesma@uni-muenster.de
data(meuse)
m = meuse
coordinates(m) = meuse[, c("x", "y")]
pts = geometry(m)
class(pts)
geometry(meuse) = pts
class(meuse)
identical(m, meuse) # TRUE
Run the code above in your browser using DataLab