<?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>idea ArcPy.mapping: expose SelectionSet property of given layer in ArcGIS Pro Ideas</title>
    <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idi-p/947646</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many of the geoprocessing tools work on a selection set, if one has been made prior to running the tool.&amp;nbsp; In the ArcObjects .NET framework, there is a SelectionSet property of the IFeatureSelection interface.&amp;nbsp; This allows one to determine whether or not a selection has been made, and to manipulate that selection.&amp;nbsp; In the ArcPy site package, the Layer class in the mapping module does not expose anything involving selections.&amp;nbsp; It would be extremely useful to expose the SelectionSet property in this module so that the Python coder could easily:&lt;BR /&gt;- Determine if a selection had been made.&lt;BR /&gt;- Get a count of how many features/records were selected.&lt;BR /&gt;- Further manipulate that selection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 04 Dec 2010 20:41:24 GMT</pubDate>
    <dc:creator>JoeVondracek1</dc:creator>
    <dc:date>2010-12-04T20:41:24Z</dc:date>
    <item>
      <title>ArcPy.mapping: expose SelectionSet property of given layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idi-p/947646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many of the geoprocessing tools work on a selection set, if one has been made prior to running the tool.&amp;nbsp; In the ArcObjects .NET framework, there is a SelectionSet property of the IFeatureSelection interface.&amp;nbsp; This allows one to determine whether or not a selection has been made, and to manipulate that selection.&amp;nbsp; In the ArcPy site package, the Layer class in the mapping module does not expose anything involving selections.&amp;nbsp; It would be extremely useful to expose the SelectionSet property in this module so that the Python coder could easily:&lt;BR /&gt;- Determine if a selection had been made.&lt;BR /&gt;- Get a count of how many features/records were selected.&lt;BR /&gt;- Further manipulate that selection.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Dec 2010 20:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idi-p/947646</guid>
      <dc:creator>JoeVondracek1</dc:creator>
      <dc:date>2010-12-04T20:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy.mapping: expose SelectionSet property of given layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947647#M6570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;If you create a describe object from a layer you can get access to the FIDSet property which returns a semi-colon delimited string of the FID of all selected features in the layer. Based on this below is some sample code to accomplish the items you mention:&lt;BR /&gt;&lt;BR /&gt;- Determine if a selection had been made.&lt;BR /&gt;&lt;BR /&gt;desc = arcpy.Describe(lyr)&lt;BR /&gt;if not&amp;nbsp; desc.FIDSet&amp;nbsp; == '':&lt;BR /&gt;&amp;nbsp;&amp;nbsp; print 'Layer has a selection'&lt;BR /&gt;&lt;BR /&gt;- Get a count of how many features/records were selected.&lt;BR /&gt;&lt;BR /&gt;2 options:&lt;BR /&gt;&lt;BR /&gt;result = arcpy.GetCount_management(lyr)&lt;BR /&gt;print result.getOutput(0)&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;desc = arcpy.Describe(lyr)&lt;BR /&gt;len(desc.FIDSet.split(";"))&lt;BR /&gt;&lt;BR /&gt;- Further manipulate that selection.&lt;BR /&gt;&lt;BR /&gt;Use select layer by attribute and Selection types, Add_To_Selection, Remove_From_Selection, or Subset_Selection to modify the existing selection.

&lt;!-- content transformation source ID: 00a3000000FVUKZ --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 22:28:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947647#M6570</guid>
      <dc:creator>ChrisFox</dc:creator>
      <dc:date>2012-04-05T22:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy.mapping: expose SelectionSet property of given layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947648#M6571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;This issue here is the difficulty in determining actual Selection Count. &amp;nbsp;If there is no Selection, the &amp;nbsp;getcount method returns the total count, not zero. &amp;nbsp;Likewise, the FIDSet returns all records in the class if there is no selection.

&lt;!-- content transformation source ID: 00aE00000028fqF --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2013 19:31:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947648#M6571</guid>
      <dc:creator>DavidNichter</dc:creator>
      <dc:date>2013-02-22T19:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy.mapping: expose SelectionSet property of given layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947649#M6572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;@davenicht, I can not reproduce what you are describing. If there is no selection FIDSet should return an empty string.

&lt;!-- content transformation source ID: 00aE00000028iMy --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Feb 2013 18:50:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947649#M6572</guid>
      <dc:creator>ChrisFox</dc:creator>
      <dc:date>2013-02-25T18:50:49Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy.mapping: expose SelectionSet property of given layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947650#M6573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;@davenicht, I was able to reproduce what you are describing. It seems that the FIDSet works differently depending upon whether or not your layer is itself based upon a selection (subset) of features from an actual feature class:&lt;BR /&gt;&lt;BR /&gt;Case 1 (@Chris_Fox)&lt;/SPAN&gt;
&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;Added feature class to ArcMap&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;FIDSet returns nothing.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;Selected some features.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;FIDSet return OIDs of selected features.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;
&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;Case 2 (@davenicht)&lt;/SPAN&gt;

&lt;OL&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;Added feature class to ArcMap&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;Selected some features.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;Chose 'Create&amp;nbsp;layer from selected features' (Right-click&amp;gt;Selection).&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;FIDSet on new layer (without selection) returned OIDS of all features in layer.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;Selected some features in the new layer.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN style="background-color: rgb(242, 246, 235); font-family: verdana; font-size: 11px;"&gt;FIDSet returned OIDs of selected features.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/OL&gt;

&lt;!-- content transformation source ID: 00aE0000008B8Js --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 02:09:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947650#M6573</guid>
      <dc:creator>DarrenSmith</dc:creator>
      <dc:date>2014-10-29T02:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy.mapping: expose SelectionSet property of given layer</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947651#M6574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Just in case anyone is interested, the workaround I've had to use is to detect whether a selection is present in all cases (see post below) is to temporarily switch the selection set and then check if the count on this is zero. If it is zero then there's not a selection set and conversley if it's not there is.&lt;BR /&gt;&lt;BR /&gt;This is kind of acceptable for small datasets, but when using large datasets, switching the selection set leads to a large overhead.

&lt;!-- content transformation source ID: 00aE0000008B8OJ --&gt;

&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Oct 2014 05:16:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/947651#M6574</guid>
      <dc:creator>DarrenSmith</dc:creator>
      <dc:date>2014-10-29T05:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: ArcPy.mapping: expose SelectionSet property of given layer - Status changed to: Implemented</title>
      <link>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/1184816#M19978</link>
      <description>&lt;P&gt;This has been implemented in ArcGIS Pro (arcpy.mp) for a while.&amp;nbsp; Changes will not be made to the arcpy.mapping API.&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layer-class.htm" target="_blank"&gt;https://pro.arcgis.com/en/pro-app/latest/arcpy/mapping/layer-class.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;See specifically:&lt;/P&gt;&lt;P&gt;Layer.getSelectionSet()&lt;/P&gt;&lt;P&gt;Layer.setSelectionSet({oidList}, [{method})&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jun 2022 19:24:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-ideas/arcpy-mapping-expose-selectionset-property-of/idc-p/1184816#M19978</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2022-06-21T19:24:23Z</dc:date>
    </item>
  </channel>
</rss>

