-2

I have 2 list of Polygon as below:

list1 = [p1, p2, p3]
list2 = [pa, pb, pc]

I want to check if p1 overlaps pa, p2 overlaps pb, and p3 overlaps pc. I used shapely.intersects to check whether they overlap with each other. But I don't know how to choose exactly p1 vs pa, p2 vs pb, p3 vs pc. How can I do that?

Windy764
  • 77
  • 7
  • can you show what do you mean by polygon intersection and what did you try ? – jkhadka Oct 01 '18 at 08:47
  • I mean I want to check if 1 polygon in list 1 is overlapped by a corresponded polygon in list 2. I tried `for i, j in zip(list1, list2): if( i.intersects(j) == True): print("Something") else: print("Something")` – Windy764 Oct 01 '18 at 09:42
  • However, is there any other way to check that one polygon is overlapped a lot by another, likes 1 polygon stay above another polygon? Since by using `shapely.intersection`, it always True even if there's a small overlapping part, likes some points – Windy764 Oct 01 '18 at 09:46

1 Answers1

1

Use zip for that:

for i, j in zip(list1, list2):
    print(i, j)

in each iteration i,j will be the same index of two different lists.

Mehrdad Pedramfar
  • 10,941
  • 4
  • 38
  • 59