On Tue, Oct 11, 2005 at 03:50:05PM +0200, Roger Bivand wrote: > On Tue, 11 Oct 2005, Yilin Liu wrote: > > > Dear all, > > > > Any way to get the length of common boundaries shared by neighbouring > > counties in a map in R? > > > > The short answer is no. The R polygon objects do not have topology. > > The longer answer is that if you have e00 or ArcInfo binary vector layers, > then the polygons are built from lists of directed arcs, and the arcs have > lengths. So if your input data are in this format, it is feasible but is > not implemented. > > It looks as though the GRASS6 vector format also provides similar > information. But topology is a GIS thing rather than an R thing, so no > solution within R is available. > > If you use GRASS, it would be possible to look at how this might be done > (read a shapefile into GRASS, output an ASCII dump of the arcs, which > polygons they separate, and how long they are, and do something with this, > not losing trace of which polygon(s) belong to which observation - this > was where progress stopped the last time I looked). Arc lengths would be > nice for cartograms too. >
In GRASS 6 you can use v.to.db [1] to generate this information (should be the combination of the options 'sides' and 'length'. Markus [1] http://grass.itc.it/grass60/manuals/html60_user/v.to.db.html -- Markus Neteler <neteler itc it> http://mpa.itc.it ITC-irst - Centro per la Ricerca Scientifica e Tecnologica MPBA - Predictive Models for Biol. & Environ. Data Analysis Via Sommarive, 18 - 38050 Povo (Trento), Italy _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo