AnsweredAssumed Answered

ArcGIS Pro SDK - Select feature from FeatureLayer

Question asked by OsDiAl31 on Oct 31, 2019
Latest reply on Nov 5, 2019 by OsDiAl31

Hi!

 

I want to select a feature from a FeatureLayer using a query and I can't find any example of it.

 

The closest code snippet I have found uses somekind of selection by intersection, but that is not going to work for me:

 

 Dim qf As QueryFilter = New QueryFilter()

qf.WhereClause = "Filed1= " & myVariable

Using rowCursor As RowCursor = fEdif.Search(qf)
    While rowCursor.MoveNext()
         Dim feature1 As Feature = TryCast(rowCursor.Current, Feature)
         Dim geo As ArcGIS.Core.Geometry.Geometry = feature1.GetShape()

          MapView.Active.SelectFeatures(geo)
                                      
     End While
End Using

That way the building I want is selected, but also the ones that are attached to it.

 

So, how can I just select the feature that is returned by the search?

The FeatureLayer has a method called SetSelection, but I can't find any example of how to use it.

 

Thanks for any help provided!!

Outcomes