This project is read-only.

FID issues

Jan 27, 2012 at 12:28 PM

I am finding that on a layer the FID is not being correctly returned on selected items.

The user selects a range of items on the map, after this I get the selection using

featureLayer.Selection.ToFeatureList();

The problem is the returned list, for this layer at least, contains features with a FID == 0.
The orginal layer is fine since it has a theme which is rendered correctly and I can look though the dataset and see the FID's.

If I then edit one of the items in our application, which causes the feature to be updated, it work fine until that layer is loaded again.

The really odd thing is if I rebuild the layer i.e. delete and re-add all of the features, it exhibits the same behaviour yet other layers created with the same code are fine.

I am at a complete loss as to what to do since without a FID it makes it impossible to allow the user to select/zoom to a specific feature when they have selected a number of features.

Any ideas ?

Feb 2, 2012 at 11:36 AM

Is anyone else having issues with FID?

I am sure it is a bug and is causing all sorts of usability problems for my application.

Oct 18, 2012 at 6:58 PM
Edited Oct 18, 2012 at 6:59 PM

using FID to delete features..

	Public Function FunctIMapLayer(AppManagerActual As AppManager, nameShape As String) As IMapLayer
	FunctIMapLayer=Nothing
	Try
		For Each actualLayer As ILayer In AppManagerActual.Map.MapFrame.GetAllLayers()
			If actualLayer.LegendText=nameShape Then
				FunctIMapLayer=actualLayer
				Exit Function
			End If
		Next
	Catch ex As Exception
		FunctIMapLayer=Nothing
		MsgBox("Error: " & ex.Message)
	End Try		
End Function


Public Sub DeleteWithFID
	Dim fLayerNodes As FeatureLayer=Nothing
	fLayerNodes=CType(appManagerFunctions.FunctIMapLayer(AppManagerActual,"WNODES"),FeatureLayer)
	If Not IsNothing(fLayerNodes) Then
		Dim listFID As List(Of Integer)=New List(Of Integer)()
		Dim listSelection As List(Of IFeature) = New List(Of IFeature)()
		listSelection = fLayerNodes.Selection.ToFeatureList()
		listSelection.Reverse()
		For i As Integer = 0 To fLayerNodes.Selection.Count-1
			listFID.Add(listSelection(i).Fid)
		Next
	End If
	
	fLayerNodes.ClearSelection()
	fLayerNodes.EditMode=True
	For i As Integer=0 To listFID.Count-1
		fLayerNodes.DataSet.RemoveShapeAt(listFID.Item(i))
	Next
	fLayerNodes.DataSet.Save()
	fLayerNodes.EditMode=False
	fLayerNodes.Invalidate()		
End Sub