[R-sig-Geo] SpatialCls

Edzer J. Pebesma e.pebesma at geog.uu.nl
Fri Nov 28 17:17:52 CET 2003

Hi Barry, Roger, r-sig-geo gang,

I just checked in updates to SpatialCls on
http://sourceforge.net/projects/r-spatial/ --
I completed documentation, added tests and examples. The
whole package should pass R CMD check. Even the S4 classes
are now documented, slots and all. No vignettes yet,
still have to get into them.

The interfaces used so far are:

# The following three promote a data.frame to a SpatialDataFrame

coordinates(meuse) = ~x+y # or
coordinates(meuse) = c("x", "y") # or
coordinates(meuse) = cbind(x,y)

# after which


# retrieves coordinates; also:

coordinates(meuse.grid) = ~x+y # followed by
gridded(meuse.grid) = TRUE

# promotes meuse.grid to a SpatialDataFrameGrid, which has
# (and auto-detects) grid topology; it has an image method.

# then,

polygons(x) = list(pol1, pol2, pol3)

# promotes data.frame x to a SpatialPolygons, adding the
# polygon information to it, doing some basic checks
# (e.g. pol1..3 should be 2column matrix with at least 4 points,
# first and last being the same);

polygons(x)     # retrieves the polygon list
data.frame(x)    # retrieves the attribute values data.frame

# some elementary plot, show, formula and summary methods are present.

What else do we need, when it comes to interfaces/methods?

Enjoy the weekend,

More information about the R-sig-Geo mailing list