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

Edzer Pebesma edzer.pebesma at uni-muenster.de
Wed Mar 8 11:27:38 CET 2017



On 07/03/17 19:13, Vijay Ramesh via R-sig-Geo wrote:
> 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

If you follow up on exchanges on stack overflow, please provide the link
to it here.

> following below. But, the process has been running continuously without
> stopping for the last 5 hours. Any suggestions?

Patience?

> 
> 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
> 

-- 
Edzer Pebesma
Institute for Geoinformatics  (ifgi),  University of Münster
Heisenbergstraße 2, 48149 Münster, Germany; +49 251 83 33081
Journal of Statistical Software:   http://www.jstatsoft.org/
Computers & Geosciences:   http://elsevier.com/locate/cageo/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170308/c35867e6/attachment.bin>


More information about the R-sig-Geo mailing list