[R-sig-Geo] How many polygons does a single polygon intersect with?

Vijay Ramesh rameshv at caryinstitute.org
Tue Mar 7 19:13:25 CET 2017


I currently possess a shapefile that consists of >5000 polygons. I would
like to know, for each polygon, how many other polygons it intersects with
and the names of each polygon it intersects with?

My output should be something like this:

[image: enter image description here] <https://i.stack.imgur.com/ELv3T.png>

Based on Jeffrey Evans suggestion on using gIntersects, I have tried the
following below. But, the process has been running continuously without
stopping for the last 5 hours. Any suggestions?

Here's the code I ran in R:

require(rgdal)
library(maptools)
library(rgeos)
library(GISTools)
Poly <- readOGR("C:\\Users\\rameshv\\Terrestrial_dissolved_multipart.shp")
Poly_join <- gIntersects(Poly)

Regards,
Vijay
-- 
Data Manager,
Barbara Han Lab,
Cary Institute of Ecosystem Studies,
2801 Sharon Turnpike, Millbrook, NY 12545
Lab Site : http://www.hanlab.science/
Personal Site : http://evolecol.weebly.com/
Phone : (845)-677-7600 Ext: 241

	[[alternative HTML version deleted]]



More information about the R-sig-Geo mailing list