[ACCEPTED]-Polygon touches in more than one point with Shapely-shapely

Accepted answer
Score: 12

If you truly want to check if two polygons 6 share more than x number of points you can 5 simply do this:

p0,p1,p2 = polygons
x = 2
len(set(p1.boundary.coords).intersection(p2.boundary.coords))>=x

But I think what you may 4 want is to determine if two edges are colinear 3 (and overlapping).

This implementation of 2 Andrew's suggestions is probably what you 1 are looking for:

>>> type(p0.intersection(p1)) is geometry.LineString
True
>>> type(p1.intersection(p2)) is geometry.LineString
False
Score: 6

i haven't used shapely, but have you tried 2 seeing if the intersection of the two polygons 1 is a line?

More Related questions