【发布时间】:2015-11-24 01:02:33
【问题描述】:
我想知道是我想错了还是这是一个错误:
我有一个线串和一个多边形, 我创建线和多边形边界的交点
这些交点应该与多边形的边界相交(至少接触),对吧?
from shapely import geometry,wkt
line = geometry.LineString([(13.51039642756912, 52.598912814414675), (13.525173800277184, 52.60620240344557)])
poly = geometry.Polygon ([(13.52072838433517, 52.61735554606274), (13.52233276805985, 52.59511541819082), (13.51312087418833, 52.59394589806786),( 13.51526963068252, 52.60338701649216),( 13.51836560008325 ,52.6009395669487), (13.52072838433517, 52.61735554606274)])
ips = line.intersection(poly.boundary)
for i in ips:
print i.touches(poly.boundary) # should touch but it doesnt!!!!
>>>False
【问题讨论】:
-
既然您正在向控制台打印一些东西,您能否在您的问题中包含此输出?
-
数字中的很多东西都是不精确的。但是,您真正想用这些信息做什么?您不能只假设交点非常接近边界 - 因为它们就是这样计算的?真的不需要检查,还是有?