Last month I asked vb.net arcobjects spatial query get fields value of desired layer only.
Now there is some change in the requirement, I need to get value of 2 layers after use "Select Features" tool in arcmap, 1 polyline and 1 polygon.
Can I use the same method?
One thing to highlight is the editable variables in attribute table of the 2 layers are the same.
My code is here:
pMxDoc = My.ArcMap.Application.Document
pMap = pMxDoc.FocusMap
pActiveView = pMxDoc.FocusMap
Dim layerNum = GetIndexNumberFromLayerName(pActiveView, "test_db.DBO.TestTable")
Dim layerNum2 = GetIndexNumberFromLayerName(pActiveView, "test_db.DBO.TestTable2")
Dim pFeatureLayer As IFeatureLayer
Dim pFeatureLayer2 As IFeatureLayer
pFeatureLayer = pMap.Layer(layerNum)
pFeatureLayer2 = pMap.Layer(layerNum2)
Dim pFeatureSelection As IFeatureSelection
pFeatureSelection = pFeatureLayer
logger.Info("pFeatureLayer = " + pFeatureLayer.Name)
Dim pSelectionSet As ISelectionSet
pSelectionSet = pFeatureSelection.SelectionSet
logger.Info("pSelection number = " & pSelectionSet.Count)
Dim pFeatureCursor As IFeatureCursor = Nothing
pSelectionSet.Search(Nothing, True, pFeatureCursor)
Dim tempArr As New List(Of String)
Dim pFeature As IFeature
pFeature = pFeatureCursor.NextFeature
Do While (Not pFeature Is Nothing)
tempArr.Add(pFeature.Value(pFeature.Fields.FindField("Item_ID")).ToString)
pFeature = pFeatureCursor.NextFeature
Loop
Sorry of the unclear requirement of the whole process. After performing the spatial query, I will retrieve data related to features of these 2 layers (from database) and allow user to select and zoom to any results from the spatial query.