<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS Pro SDK - Select feature from FeatureLayer in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866906#M4983</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;I want to select a feature from a FeatureLayer using a query and I can't find any example of it.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;The closest code snippet I have found uses somekind of selection by intersection, but that is not going to work for me:&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt; Dim qf As QueryFilter = New QueryFilter()

qf.WhereClause = "Filed1= " &amp;amp; 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‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;That way the building I want is selected, but also the ones that are attached to it.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;So, how can I just select the feature that is returned by the search?&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;The FeatureLayer has a method called SetSelection, but I can't find any example of how to use it.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;Thanks for any help provided!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:47:31 GMT</pubDate>
    <dc:creator>OscarDiago_Alonso</dc:creator>
    <dc:date>2021-12-12T10:47:31Z</dc:date>
    <item>
      <title>ArcGIS Pro SDK - Select feature from FeatureLayer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866906#M4983</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;I want to select a feature from a FeatureLayer using a query and I can't find any example of it.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;The closest code snippet I have found uses somekind of selection by intersection, but that is not going to work for me:&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt; Dim qf As QueryFilter = New QueryFilter()

qf.WhereClause = "Filed1= " &amp;amp; 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‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;That way the building I want is selected, but also the ones that are attached to it.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;So, how can I just select the feature that is returned by the search?&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;The FeatureLayer has a method called SetSelection, but I can't find any example of how to use it.&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;P&gt;Thanks for any help provided!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:47:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866906#M4983</guid>
      <dc:creator>OscarDiago_Alonso</dc:creator>
      <dc:date>2021-12-12T10:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK - Select feature from FeatureLayer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866907#M4984</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Oscar,&lt;/P&gt;&lt;P&gt;You do not need any code snippet. Just use Select method from FeatureLayer. Like that:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;featLayer.Select(qf); // your query filter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Nov 2019 09:15:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866907#M4984</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2019-11-05T09:15:40Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro SDK - Select feature from FeatureLayer</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866908#M4985</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I got the wrong idea that that method only worked with QuerySpatialFilter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Nov 2019 11:56:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-sdk-select-feature-from-featurelayer/m-p/866908#M4985</guid>
      <dc:creator>OscarDiago_Alonso</dc:creator>
      <dc:date>2019-11-05T11:56:13Z</dc:date>
    </item>
  </channel>
</rss>

