[R-pkgs] New CRAN package sp: classes and methods for spatial data

Edzer J. Pebesma e.pebesma at geog.uu.nl
Fri Jun 17 16:20:15 CEST 2005

We're happy to announce the CRAN release of "sp", an R package which
has new-style classes and methods for spatial data, version 0.7-9.

Spatial data types that sp implements are: points, grids, lines, and
polygons (i.e., rings) optionally with holes. Methods include

+ the usual print, summary, plot, [, [[, $, ...
+ coercion between types (e.g. points and grids, matrices, data.frames)
+ coordinates(x), which returns the spatial coordinates of x
+ bbox(x), returns the coordinates bounding box of x
+ overlay, to query the value of e.g. points in polygons or grid
   (essentially does a point-in-polygon or point-in-raster cell)
+ spsample, for random sampling methods over a spatial domain.

An additional package (spproj) provides coordinate reference system
transformation (projection and re-projection) using the PROJ.4 library
[2]. Others (will) provide interfaces to GRASS 6 and gdal.

A good deal of work has also gone into providing plotting methods using
base, grid and lattice graphics, through the spplot function, a front-end
to lattice plots for spatial data (see gallery [1]).

The home page of these packages is found at
See also the Task View on Spatial Data Analysis, linked from CRAN.

The reason why we wrote this package is that we think R is an excellent
environment to deal with spatial data, but that it lacks a uniform way
to deal with spatial data. Compared to the handling of dates and times,
which can utilize base classes or those provided in the chron package,
spatial data handling is much more fragmented. As a consequence:

- various packages make their own assumptions about how spatial data
   are organized
- spatial data organized for a certain package cannot easily be used
   for another package
- few (or no) packages address the full range of spatial data types
   (points, grids, lines, polygons) and their interaction
- generic spatial functionality (e.g. I/O to GIS, plotting, projection)
   is scattered and often limited in functionality.

It also means that many different package authors have to use time writing
similar data handling code, rather than concentrating on analytical
functions. If the sp package achieves its goals, data I/O will become
many-to-one, and data access for analysis one-to-many, providing a shared
data object layer for which shared methods can be written.

Classes and methods for spatial data are only useful when the spatial
packages support them. The sp development team includes maintainers of
a number of spatial R packages, on which we will work, and we hope that
over time other spatial package maintainers will also provide support
for the classes provided by this package.

Although we are working towards a fixed set of classes at this moment
of the development of sp we cannot fully guarantee that the exact
representation of the sp classes will not change in the future. Therefore,
we advise users to keep the scripts with instructions of building the
data into sp classes; it is most likely that we will not change the
building functions and methods.

Work in progress currently involves:
- support of sp classes by several spatial statistics packages
- automatic determination of hole polygons from shapefiles
- plotting filled polygons with holes
- gdal read/write support
- GRASS 6.0 support

The development of this package is a joint effort of Virgilio Gomez-Rubio,
Barry Rowlinson, Roger Bivand and Edzer Pebesma, and followed from
discussions held at a pre-DSC2003 workshop [3], announcements on R-sig-geo
[4], and a meeting held last November in Lancaster [5]. A beta release
of sp was announced a while ago on R-sig-geo [6].

With best regards,
Roger Bivand and Edzer Pebesma

[1] http://r-spatial.sourceforge.net/
[2] http://www.remotesensing.org/proj/
[3] http://spatial.nhh.no/meetings/vienna/index.html
[4] e.g. https://stat.ethz.ch/pipermail/r-sig-geo/2003-October/000028.html
[5] http://elearning.maths.lancs.ac.uk:8080/RSpatial/
[6] https://stat.ethz.ch/pipermail/r-sig-geo/2005-April/000378.html

More information about the R-packages mailing list