[R-sig-Geo] Re: [R] A package for spatial data classes: request for comments

Edzer J. Pebesma e.pebesma at geog.uu.nl
Mon Nov 3 16:08:17 CET 2003


Barry Rowlingson wrote:

>
>> To be really useful, the class should include vector (polygon) data,
>> and probably line elements. For this, I need help. The simples approach
>> would be to extend SpatialDataFrame to SpatialDataFramePolygon,
>> and add for each row add the corresponding polygon.
>
>
>  I think you need to stop thinking about building classes at the 
> moment, and to think about specifying _interfaces_. What methods do we 
> want for spatial data? How will functions get the spatial data out of 
> the objects? Then we can build classes that implement these interfaces.

Baz, I agree that interfaces are important. Still, concentrating on 
interfaces _only_
does encourage package writers to come up each with a new set of spatial 
classes
-- something I would like to discourage: sharing more code makes the 
code more
reliable.

I did build upon your idea of sp.coords, but called it coordinates, and 
used reference (column name/numbers) instead of actual values:

coordinates(meuse) = c("x", "y")

I prefer coordinates because at some stage the S3 method mechanism may
interpret sp.coords as an sp method for a coords class.

My question, in your perspective, would be: which methods do we need for
a generic class containing vector/polygon data?

E.g. how is,

polygons(world) # gets or sets the polygons, as a list of 2 col matrices
polygonAttributes(world) # gets or sets the polygon attributes, as data 
frame
--
Edzer




More information about the R-sig-Geo mailing list