如何找到一对线段的交点?

时间:2019-04-16 04:11:19

标签: python-2.7

我有一对线,我想找到它们彼此之间的相交。我知道我可以执行以下两条操作:

from shapely.geometry import LineString

line1 = LineString([(0,0), (1,0), (1,1)])
line2 = LineString([(0,1), (1,1)])

print(line1.intersection(line2)). 

假设我有以下多行字符串,我正在寻找每对之间的交集吗?

MULTILINESTRING ((0 0, 0 20), (20 0, 20 20), (7.49080237694725 11.97316968394073, 5.67208473076472 5.229834926470677), (19.01428612819832 3.12037280884873, 25.96681259449994 4.024633854021577), (14.6398788362281 3.119890406724053, 21.51766222234933 1.803845175041164))

0 个答案:

没有答案