NetTopologySuite ConcaveHull ends with the exception

66 Views Asked by At

I use NetTopologySuite.Algorithm.Hull.ConcaveHull.ConcaveHullByLengthRatio (Geometry geom, double lengthRatio, bool isHolesAllowed) to build a concave hull. Sometimes the function works fine, but sometimes it falls with an exception:

NetTopologySuite.Triangulate.QuadEdge.LocateFailureException: Locate failed to converge (at edge: LINESTRING( 38.52788223 59.20800324999999, 38.529696464538574 59.20393475499401)).  Possible causes include invalid Subdivision topology or very close sites
         at NetTopologySuite.Triangulate.QuadEdge.QuadEdgeSubdivision.LocateFromEdge(Vertex v, QuadEdge startEdge)
         at NetTopologySuite.Triangulate.QuadEdge.LastFoundQuadEdgeLocator.Locate(Vertex v)
         at NetTopologySuite.Triangulate.IncrementalDelaunayTriangulator.InsertSite(Vertex v)
         at NetTopologySuite.Triangulate.IncrementalDelaunayTriangulator.InsertSites(ICollection`1 vertices)
         at NetTopologySuite.Triangulate.DelaunayTriangulationBuilder.Create()
         at NetTopologySuite.Triangulate.DelaunayTriangulationBuilder.GetSubdivision()
         at NetTopologySuite.Algorithm.Hull.HullTriangulation.CreateDelaunayTriangulation(Geometry geom)
         at NetTopologySuite.Algorithm.Hull.ConcaveHull.GetHull()
         at NetTopologySuite.Algorithm.Hull.ConcaveHull.ConcaveHullByLengthRatio(Geometry geom, Double lengthRatio, Boolean isHolesAllowed)

lengthRatio is 0.2, isHolesAllowed is true.

geom is MultiPoint containing coordinates, for example .

I've tried to change lengthRatio from 0.1 to 1.0 and set isHolesAllowed to false - nothing changed.

If someone has faced a similar problem, please help me. What should I do to avoid such behaviour of the function?

0

There are 0 best solutions below