[R-sig-Geo] line segments of boundaries

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 14 10:42:14 CET 2007


On Wed, 14 Mar 2007, Edzer J. Pebesma wrote:

> Hi,
> 
> Is there an R package/function that, given a set of polygons (say 
> country boundaries) finds the line set of lines that defines the 
> boundary for each pair of neighbouring countries?

poly2nb() in spdep only finds *polygons* sharing one/two boundary points,
it does not do the topology by breaking the polygons into arcs and nodes.  

If you need the topology, I suggest that you establish a GRASS location,
read the vector polygons into GRASS 6, best 6.3 CVS, which will build the
topology - it may need cleaning and repair - then look at vect2neigh() in 
the spgrass6 package. This does most of what is needed to retrieve IDs of 
neighbouring polygons, and the length of their boundaries. If I recall 
correctly, it aggregates multiple boundaries between the same pair of 
polygons, which may not suit your case. The ideas and changes in GRASS 
were made by Markus Neteler.

Roger

> --
> Edzer
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no




More information about the R-sig-Geo mailing list