This project is read-only.

exception when using ST.UnionAggregate() function

Topics: Project Management Forum
Jul 9, 2007 at 6:35 AM
Edited Jul 9, 2007 at 7: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)
GisSharpBlog.NetTopologySuite.Geometries.TopologyException:
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
union
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 8:33 AM
Maybe this issue could be useful:
http://www.codeplex.com/MsSqlSpatial/WorkItem/View.aspx?WorkItemId=9666
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 10:18 AM
i test methods mentioned on that topic, still error,
Jul 9, 2007 at 10: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 1: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 7: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...