【问题标题】:how merge polygons with nettopologysuite?如何将多边形与 nettopologysuite 合并?
【发布时间】:2018-04-14 04:06:44
【问题描述】:

我必须合并一组多边形来创建一个新的多边形。
有时会发生我在多边形之间有小洞,所以当我尝试合并它们时会收到错误。
我该如何检测并解决这个问题?

更新一些错误示例

side location conflict [ (12.235768128349596, 44.387249570104892, NaN) ]
   at NetTopologySuite.Operation.Overlay.Snap.SnapIfNeededOverlayOp.GetResultGeometry(SpatialFunction opCode)
   at NetTopologySuite.Geometries.Geometry.Union(IGeometry other)
   at NetTopologySuite.Operation.Union.CascadedPolygonUnion.UnionOptimized(IGeometry g0, IGeometry g1)
   at NetTopologySuite.Operation.Union.CascadedPolygonUnion.Union()
   at NetTopologySuite.Operation.Union.UnaryUnionOp.Union()

found non-noded intersection between LINESTRING(12.448591764796777 41.972860890341124, 12.448731325430401 41.972841479998927) and LINESTRING(12.449 41.973, 12.448695198462875 41.972831837041554) [ (12.448716431340822, 41.972843551495508, NaN) ]
   at NetTopologySuite.Noding.FastNodingValidator.CheckValid()
   at NetTopologySuite.Operation.Overlay.OverlayOp.ComputeOverlay(SpatialFunction opCode)
   at NetTopologySuite.Operation.Overlay.OverlayOp.Overlay(IGeometry geom0, IGeometry geom1, SpatialFunction opCode)

Invalid number of points in LineString (found 1 - must be 0 or >= 2)
   at NetTopologySuite.Geometries.LineString..ctor(ICoordinateSequence points, IGeometryFactory factory)
   at NetTopologySuite.Geometries.GeometryFactory.CreatePolygon(ICoordinateSequence coordinates)

【问题讨论】:

  • 您遇到的错误是什么?

标签: c# gis nettopologysuite


【解决方案1】:

您遇到的大多数错误都是由于无效的几何图形造成的。您可以使用geometry.IsValidNetTopologySuite.Operation.Valid.IsValidOp 类检查几何是否有效。要纠正这些错误,您通常可以使用 0 偏移量缓冲区:geometry = geometry.Buffer(0)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-20
    • 1970-01-01
    • 2018-12-22
    • 2021-07-03
    • 1970-01-01
    • 2017-07-22
    • 2017-09-15
    • 2016-02-03
    相关资源
    最近更新 更多