How many polygons does a single polygon intersect with?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How many polygons does a single polygon intersect with?

R-sig-geo mailing list
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]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How many polygons does a single polygon intersect with?

edzer


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/


_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

signature.asc (484 bytes) Download Attachment
Loading...