Help: Update function with a feature class is not working!!

Forum to discuss about issues like tutorials, programming and other topics related to GIS.
Post Reply
Posts: 29
Joined: Tue Sep 25, 2007 2:14 pm

Help: Update function with a feature class is not working!!

Post by Rose » Tue Nov 06, 2007 6:30 pm


may someone help me?

I have a problem with code writting.

A feature class has to be called meny times in a loop. This feature class has to be updated. The update function works only with first step of the loop, then it is stoped at the next step.

the error message says that the index table from this feature class is blocked and I am not allowed to access into it.

The code is as follows:

Private Sub Run1()

'feature classes

Dim pFact As IWorkspaceFactory
Dim pFeatws As IFeatureWorkspace

pFact = New AccessWorkspaceFactory

pFeatws = pFact.OpenFromFile(FGW_Sohle_WS_Name, 0)
Sohle_pFeatcls = pFeatws.OpenFeatureClass(FGW_Sohle_FCS_Name)
Gelli_pFeatcls = pFeatws.OpenFeatureClass(FGW_Gelli_FCS_Name)
Gelre_pFeatcls = pFeatws.OpenFeatureClass(FGW_Gelre_FCS_Name)

Dim i, j, k, RID As Integer
Dim CS_pFeatclsCopy As IFeatureClass

REM test
Me.MakeCopy(CS_pFeatcls, F_C_Name)
Dim pFacttest As IWorkspaceFactory
Dim pFeatwstest As IFeatureWorkspace
pFacttest = New AccessWorkspaceFactory
pFeatwstest = pFacttest.OpenFromFile(Save_Path, 0)

REM pFact = New AccessWorkspaceFactory

REM CS_pFeatclsCopy = Me.MakeCopy(CS_pFeatcls, F_C_Name)

For k = 0 To Select_Sohle_State_List.Count - 1
If Select_Sohle_State_List(k) = 1 Then
CS_pFeatclsCopy = pFeatwstest.OpenFeatureClass(F_C_Name)
Dim Plus_Step, ContourValue As Double
Plus_Step = 0.001

RID = Me.Select_Sohle_ID_List(k)

Dim Route As IFeature = Me.GetFeature(Sohle_pFeatcls, RID)
Dim Max As Double = GetMaxSubsidance(Route.Shape)
If Max = 0 Then Exit Sub

'MakeCopy of Crossection Feature Class
'CS_pFeatclsCopy = Me.MakeCopy(CS_pFeatcls, F_C_Name)

'Get Gelli with Route_ID=104
Dim GelLiFeat As IFeature = Me.GetFeature(Gelli_pFeatcls, RID, "D_ROUTE_ID")

'Get Gelre with Route_ID=104
Dim GelReFeat As IFeature = Me.GetFeature(Gelre_pFeatcls, RID, "D_ROUTE_ID")

'Get crossections with subsidance rate > 20cm
Dim CSList As New ArrayList

CSList = Me.GetCrossections(CS_pFeatclsCopy, Route.Shape, GelLiFeat.Shape, GelReFeat.Shape, RID)

'extend crossections from the list
Dim tempCSList As New ArrayList
Dim strWhereClause As String = ""
For i = 0 To CSList.Count - 1
If i = 0 Then
strWhereClause = CS_pFeatclsCopy.OIDFieldName & "=" & CSList(i).OID
strWhereClause = strWhereClause & " OR " & CS_pFeatclsCopy.OIDFieldName & "=" & CSList(i).OID
End If

'start editing
Dim pWorkspaceEdit As IWorkspaceEdit
Dim pDataset As IDataset = CS_pFeatclsCopy
pWorkspaceEdit = pDataset.Workspace

Dim OutCSList As New ArrayList

// The problem is here, with the function ExtendCrossection
Me.ExtendCrossection(CS_pFeatclsCopy, strWhereClause, CSList, Max, RID, Route)
Me.CheckIfCrossectionIntersect(CS_pFeatclsCopy, Gelli_pFeatcls, Gelre_pFeatcls, RID, tempCSList, OutCSList)

If OutCSList.Count > 0 Then
Me.SetNewGeometry(CS_pFeatclsCopy, OutCSList)
End If


End If

'Add layer to ArcMap
Me.AddLayer(CS_pFeatclsCopy, m_app)

End Sub

Public Sub ExtendCrossection(ByVal FeatureClass As IFeatureClass, ByVal WhereClause As String, ByVal CSList As ArrayList, ByVal Max As Double, ByVal RID As Integer, ByVal Route As IFeature)
Dim i As Integer = 0
Dim pCS As IFeature
Dim Qf As New QueryFilter
Qf.WhereClause = WhereClause

Dim pUpdateFeatureCursor As IFeatureCursor
Dim NewFeatureCount As Integer = 0

//The problem is here, with update
pUpdateFeatureCursor = FeatureClass.Update(Qf, False)

Dim pGS As IGeoDataset = FeatureClass
Dim ContourValue As Double
Dim OID As Integer
Dim IP As IPoint
pCS = pUpdateFeatureCursor.NextFeature
Do While Not pCS Is Nothing
'Update feature
ContourValue = Me.GetContourValue(CSList, pCS.OID, Max)
ContourValue = Format(ContourValue, "F")
IP = Me.GetIPoint(CSList, pCS.OID)
pCS = ExtendLine(pCS, pGS.Extent.Envelope, ContourValue, Route, IP)
If i = 100 Then
i = 0
End If
i += 1
pCS = pUpdateFeatureCursor.NextFeature


Catch ex As Exception
End Try
End Sub

Posts: 1
Joined: Thu Dec 27, 2018 12:21 pm
Location: Dubai

Post by sarahemi45 » Thu Dec 27, 2018 2:00 pm

yes i just let you know i am also a developer at Custom logo designer at dubai based company. here i am not graphic designer, i am a developer. i have also face this issue, you must know these work responsible features so that you can get an error issue.
remember the feature class is responsible of symbolize layer that indicates you may have a problem with geo database.
hello i am Custom logo designer at dubai based company. here i am website designer and logo designer and have 6 years of experiance in the same field.

Post Reply