【发布时间】:2019-08-07 11:53:41
【问题描述】:
我正在尝试使用 python OGR 库获取两个多边形的相交几何结果。
我已经验证了每个多边形都是一个几何图形并且它们相交。但是,intersects 返回 true,而 Intersection 返回 None。有什么想法吗?
# First polygon
ringA = ogr.Geometry(ogr.wkbLinearRing)
ringA.AddPoint(1179091.1646903288, 712782.8838459781)
...
polyA = ogr.Geometry(ogr.wkbPolygon)
polyA.AddGeometry(ringA)
# Second polygon
ringB = ogr.Geometry(ogr.wkbLinearRing)
ringB.AddPoint(1179091.1646903288, 712782.8838459781)
...
polyB = ogr.Geometry(ogr.wkbPolygon)
polyB.AddGeometry(ringB)
if (polyA.Intersects(polyB)) # returns True
return polyA.Intersection(polyB) # returns None
【问题讨论】:
标签: python geometry intersection ogr