Skip to main content
 首页 » 编程设计

python之如何查找 Shapely LineString 是否复杂(即自相交)

2024年09月07日12www_RR

要么我遗漏了什么——我在文档中看不到它——或者它不是 Shapely 的内置:我如何确定 LineString 是否复杂,即自相交?

请您参考如下方法:

它的基类 class shapely.geometry.base.BaseGeometry 有一个选项 is_simple,表示

True if the geometry is simple, meaning that any self-intersections are only at boundary points, else False

http://toblerity.org/shapely/shapely.geometry.html#shapely.geometry.base.BaseGeometry

line = LineString([(0, 0), (1, 1)]) 
line.is_simple