ITopological Operator, Intermittent COMException on Union

Discussion created by david.plume on Apr 6, 2010
Latest reply on Oct 3, 2012 by Hornbydd
Hi Everyone, I'm getting intermittent errors on calls to the Union function for ITopologicalOperator.

The Error looks like this:

Error Source System.Runtime.InteropServices.COMException (0x80040218): Exception from HRESULT: 0x80040218   at ESRI.ArcGIS.Geometry.ITopologicalOperator.Union(IGeometry other)

Any ideas would be appreciated, I've found minimal info about this problem on the forums and documents online.


The code looks like this:

              '  Now work the geometry...

                Dim pNewPolyline As ESRI.ArcGIS.Geometry.IPolyline
                pNewPolyline = Nothing

                Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature

                Dim pTopoOp As ESRI.ArcGIS.Geometry.ITopologicalOperator5 = Nothing

                Dim pNewFeature As ESRI.ArcGIS.Geodatabase.IFeature = Nothing
                '  Featureset contains two or more sector line
                '  features that have the same assignment and belong
                '  to the same perimeter polygon.  Merge their shapes
                '  to create as single geometry from them.

                '  Get the feature metadata from the first feature.
                '  it will be used to populate metadata on the resulting
                '  feature.  Since all the line features are associated
                '  with the same polygon, they should all have the
                '  same metadata.

                Dim pMetadata As FIMTExtensionNET.clsFIMTMetadataNET
                pMetadata = Nothing

                pFeature = FeatureSet.Next

                Do While Not pFeature Is Nothing

                    If pMetadata Is Nothing Then
                        pMetadata = New FIMTExtensionNET.clsFIMTMetadataNET
                    End If

                    If pNewPolyline Is Nothing Then
                        pNewPolyline = pFeature.ShapeCopy
                        pTopoOp = CType(pNewPolyline, ESRI.ArcGIS.Geometry.ITopologicalOperator5)
                        pNewPolyline = pTopoOp.Union(pFeature.ShapeCopy)  '<<<<<<<<<<<<<<<<<<<<< Where the Exception is thrown.
                        pTopoOp = CType(pNewPolyline, ESRI.ArcGIS.Geometry.ITopologicalOperator5)
                    End If

                    pFeature = FeatureSet.Next