I've developed VB.Net a tool to split all lines in a selected layer at the intersection of a point feature. Its use in a current project is for each of 17000 points, locate the line intersected by the point, split the line, populate various fields. The tool has started running very slowly, processing only one or two features per second and randomly throwing the following exception. Sometimes it will successfully edit 1500 features and sometimes 50 before this error is encountered.[ATTACH=CONFIG]11092[/ATTACH]I've tried using both IFeatureEdit.Split which creates two new lines and deletes the old one and IFeatureEdit2.SplitWithUpdate which shortens original line to split point and creates a new line for the other half of the original line. Both run equally slowly. Public Sub SplitAtPoint2(ByRef LineFeatLayer As IFeatureLayer, ByVal pPointFeature As IFeature)
'On Error GoTo ErrorHandler
Dim pPointFC As IFeatureClass
Dim pSFilter As ISpatialFilter
Dim pLineCursor As IFeatureCursor
Dim pLineFeature As IFeature
Dim pLineFC As IFeatureClass
Dim pCurve As ICurve
Dim pFeatureEdit As IFeatureEdit2
'Dim pFeatureEdit As IFeatureEdit
Dim pPoint As IPoint
Dim SplitOccured As Boolean = False
Dim pRelOp As IRelationalOperator
Dim pEditorLayers As IEditLayers
Dim pUid As New UID
Dim pEnumLayer As IEnumLayer
Dim pLayer As ILayer
Dim pFLayer As IFeatureLayer
Dim pPolygon As IPolygon
Dim pTopoOp As ITopologicalOperator
Dim UnitID As String = ""
Dim UnitID2 As String = ""
Dim UnitID3 As String = ""
Dim UnitIDIndx As Integer
Dim UnitIDIndx2 As Integer
Dim UnitIDIndx3 As Integer
UnitIDIndx3 = pPointFeature.Fields.FindFieldByAliasName("WWW_ID")
If IsDBNull(pPointFeature.Value(UnitIDIndx3)) Then
UnitID3 = Nothing
Else
UnitID3 = CType(pPointFeature.Value(UnitIDIndx3), String)
End If
Dim TempCurve As ICurve
Dim NewLines As ISet
Dim TempLine As IFeature
pPointFC = pPointFeature.Class
pPoint = pPointFeature.Shape
'Create spatial filter to find intersecting features at this given point
pSFilter = New SpatialFilter
pTopoOp = pPoint
pPolygon = pTopoOp.Buffer(dTolerance)
pSFilter.Geometry = pPolygon
pSFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects
If LineFeatLayer.FeatureClass.ShapeType = esriGeometryType.esriGeometryPolyline Then
pSFilter.GeometryField = LineFeatLayer.FeatureClass.ShapeFieldName
pLineFC = LineFeatLayer.FeatureClass
pLineCursor = pLineFC.Search(pSFilter, False)
pLineFeature = pLineCursor.NextFeature
If Not pLineFeature Is Nothing Then
UnitIDIndx = pLineFeature.Fields.FindFieldByAliasName("UNITID")
UnitIDIndx2 = pLineFeature.Fields.FindFieldByAliasName("UNITID2")
End If
Do While Not pLineFeature Is Nothing
If IsDBNull(pLineFeature.Value(UnitIDIndx)) Then
UnitID = Nothing
Else
UnitID = pLineFeature.Value(UnitIDIndx)
End If
If IsDBNull(pLineFeature.Value(UnitIDIndx2)) Then
UnitID2 = Nothing
Else
UnitID2 = pLineFeature.Value(UnitIDIndx2)
End If
pFeatureEdit = pLineFeature
pRelOp = pPolygon
pPolygon = pTopoOp.Buffer(dTolerance)
pCurve = pLineFeature.Shape
If Not (pRelOp.Contains(pCurve.FromPoint)) And Not (pRelOp.Contains(pCurve.ToPoint)) Then
NewLines = pFeatureEdit.Split(pPoint)
'NewLines = pFeatureEdit.SplitWithUpdate(pPoint)
Dim i As Integer = 0
NewLines.Reset()
TempLine = NewLines.Next
While Not TempLine Is Nothing
TempCurve = TempLine.Shape
If TempCurve.ToPoint.Compare(pCurve.ToPoint) = 0 Then
TempLine.Value(UnitIDIndx2) = UnitID2
TempLine.Value(UnitIDIndx) = UnitID3
End If
If TempCurve.FromPoint.Compare(pCurve.FromPoint) = 0 Then
TempLine.Value(UnitIDIndx) = UnitID
TempLine.Value(UnitIDIndx2) = UnitID3
End If
If Not TempLine Is Nothing Then
TempLine.Store()
End If
TempLine = NewLines.Next
End While
NewLines = Nothing
lCount += 1
SplitOccured = True
Exit Do
End If
pLineFeature = pLineCursor.NextFeature
Loop
If SplitOccured = False Then
PointNoSplit += 1
End If
'pLineCursor.Flush()
pLineCursor = Nothing
pLineFeature = Nothing
UnitID = Nothing
UnitID2 = Nothing
UnitID3 = Nothing
TempCurve = Nothing
NewLines = Nothing
TempLine = Nothing
End If
pSFilter = Nothing
pPointFC = Nothing
pLineCursor = Nothing
pLineFeature = Nothing
pCurve = Nothing
pFeatureEdit = Nothing
pPoint = Nothing
SplitOccured = Nothing
pRelOp = Nothing
pEditorLayers = Nothing
pUid = Nothing
pEnumLayer = Nothing
pLayer = Nothing
pFLayer = Nothing
pPolygon = Nothing
pTopoOp = Nothing
Exit Sub
'AbortEdit3:
' pEditor.AbortOperation()
' Debug.Print("Error spliting at point " & pPointFeature.OID)
'ErrorHandler:
' MsgBox("SplitAtPoint FAIL: " & Err.Description)
End Sub
In ArcGIS 9.3 this tool ran fine and would complete processing of the 1700 features in an hour or so. I'm in the process of upgrading the tool to work with ArcGIS 10 but can't seem to resolve this issue. I'm running ArcGIS 10.0 Service pack 2 on a Windows XP machine. I've tried it on a machine with Win 7, ArcGIS 10.0 SP2 with same result. As I did for the 9.3 implementation of this tool, I've set the JET engine max # of records to calculate in the ArcMap Advanced Settings Utility to one million to prevent hitting the max number of tables limit.Any input or suggestions would be greatly appreciated.Thanks,Mark