[R-sig-Geo] Better print method for Spatial*DataFrames?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue May 18 17:04:06 CEST 2010


Currently if I print a spatial polygon data frame I get the list
representation, which almost always scrolls way of the screen as giant
lists of lists of coordinates whizz past. It's nearly always useless
and luckily ESS lets me C-c C-o and zap the output. For
SpatialPointsDF you get:

        coordinates letters LETTERS
1    (1, 0.0486677)       a       A
2     (2, 0.520911)       b       B
3     (3, 0.207873)       c       C
4     (4, 0.466571)       d       D

- for spatial polys and lines would it be better to have such a
compact representation as the default print? I'd rather use the word
'geometry' and have it print as a (truncated) pseudo-WKT, something
like:

     geometry letters LETTERS
1   POINT(1  0.0486677)       a       A
2   POINT(2  0.520911)       b       B

 for points, and:

     geometry letters LETTERS
1   LINESTRING(...)       a       A

 for lines, and:

     geometry letters LETTERS
1  POLYGON(...)       a       A

 for polygons. Or MULTIPOLYGON, whichever is appropriate. I think it
should literally print dot-dot-dot, since for anything other than
points its going to be voluminous.

Today I am a random idea factory...

Barry



More information about the R-sig-Geo mailing list