exception when using ST.UnionAggregate() function

Topics: Project Management Forum
Jul 9, 2007 at 5:35 AM
Edited Jul 9, 2007 at 6:02 AM
when we are union an polygon that contains 3239 points with a collection of polygons, it throws an exception like this:

A .NET Framework error occurred during execution of user defined routine or aggregate 'UnionAggregate':
GisSharpBlog.NetTopologySuite.Geometries.TopologyException: no outgoing dirEdge found (-122.402590183975, 38.1492825103084, NaN)
at GisSharpBlog.NetTopologySuite.GeometriesGraph.DirectedEdgeStar.LinkResultDirectedEdges()
at GisSharpBlog.NetTopologySuite.GeometriesGraph.PlanarGraph.LinkResultDirectedEdges(IList nodes)
at GisSharpBlog.NetTopologySuite.Operation.Overlay.PolygonBuilder.Add(IList dirEdges, IList nodes)
at GisSharpBlog.NetTopologySuite.Operation.Overlay.PolygonBuilder.Add(PlanarGraph graph)
at GisSharpBlog.NetTopologySuite.Operation.Overlay.OverlayOp.ComputeOverlay(SpatialFunctions opCode)
at GisSharpBlog.NetTopologySuite.Geometries.Geometry.Union(Geometry other)
at UnionAggregate.Accumulate(SqlBytes ewkb)

the sql statement is like :

select id,name, ST.UnionAggregate(tmp.the_geom) from
select 1 id,'test' name,thegeom from sampledma where sample_dma.oid = 1
select 1 id,'test' name,samplecable.thegeom from sampledma,samplecable
where sampledma.oid = 1 and ST.Intersects(sampledma.thegeom,samplecable.the_geom) = 1
and ST.Contains(sampledma.thegeom,samplecable.thegeom) = 0
) tmp group by id,name

it seems that it is due to that points of that polygons is too big, i use ST.NPoints() to get the number, it is from 69 to 4022;

what shall i do then? any suggestion will be appreciated;
Jul 9, 2007 at 7:33 AM
Maybe this issue could be useful:
In any case, could you send me the geograohic data (as shapefile or WKB/WKT) at diegoguidi at gmail dot com, so i could test this issue?
Jul 9, 2007 at 9:18 AM
i test methods mentioned on that topic, still error,
Jul 9, 2007 at 9:45 AM
The data you've sent is invalid, because ALL the polygon's shells are not closed.
So, it's impossibile to perform this operation.
Jul 10, 2007 at 12:58 AM

D_Guidi wrote:
The data you've sent is invalid, because ALL the polygon's shells are not closed.
So, it's impossibile to perform this operation.

but why i use ST.IsValid(), it returns 1;
and if i change the sql, it runs well
Jul 10, 2007 at 6:55 AM
Here (http://nettopologysuite.googlecode.com/svn/trunk/NetTopologySuite.Samples.Console/Tests/Various/UnionAggregateTest.cs) you could find the tests for your data: i read simply the shapefile and i check IsValid, that fails...