[ACCEPTED]-Polygon touches in more than one point with Shapely-shapely
Accepted answer
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
i haven't used shapely, but have you tried 2 seeing if the intersection of the two polygons 1 is a line?
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.