[R-sig-Geo] newbie sp question

David Hugh-Jones d-hugh-jones at northwestern.edu
Sat Jun 16 03:26:49 CEST 2007

Hi R-spatialists,

I'm working with a big list of polygons (imported into R with package
sp as a SpatialPolygonDataFrame, and I am trying to calculate minimum
distances between each pair of polygons. For this, I need to get the
lines for each polygons. At the moment I can't seem to find a way to
do this except to delve right in with

for (p in spdfc at polygons) {
	    for (q in p at Polygons)
			linesc <- rbind(linesc, coordinates(q))

and then to add the endpoints of linesc as columns 3 and 4 of the
matrix. Is there a simpler  way to extract lines from polygons?


More information about the R-sig-Geo mailing list