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

Edzer Pebesma edzer.pebesma at uni-muenster.de
Thu May 27 15:26:07 CEST 2010


Nice suggestion! I did this for points (committed to cvs), as option in
print, and get

> options(width=60)
> print(meuse[1:3,], sWKT=T)
              geometry cadmium copper lead zinc  elev
1 POINT(333611 181072)    11.7     85  299 1022 7.909
2 POINT(333558 181025)     8.6     81  277 1141 6.983
3 POINT(333537 181165)     6.5     68  199  640 7.800
        dist   om ffreq soil lime landuse dist.m
1 0.00135803 13.6     1    1    1      Ah     50
2 0.01222430 14.0     1    1    1      Ah     30
3 0.10302900 13.0     1    1    1      Ah    150

For (multi)lines / polygons, would it be useful to print the first
coordinate followed by ..., so that some kind of identification is possible?

On 05/18/2010 05:04 PM, Barry Rowlingson wrote:
> 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
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list