<?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 Re: Select features by subtype in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55090#M4341</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand how your script works - I would never have known about the 'Set' function without your reply. I'll give it a try in the near future.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Dec 2010 09:35:35 GMT</pubDate>
    <dc:creator>LeeMusto</dc:creator>
    <dc:date>2010-12-21T09:35:35Z</dc:date>
    <item>
      <title>Select features by subtype</title>
      <link>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55086#M4337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have numerous geodatabase feature classes, each of which contains several subtypes, so in total there are approx 150 different subtypes. I need to create new separate feature classes for each of those subtypes, containing all of the features of that particular subtype (so that I can output them to a text file). I am quite new to scripting, but believe I could achieve this if I created a list of all those subtypes. However, I assume I should be able to do this without the need to create the list. I understand loops, but it's how to group the features according to subtype that I am struggling with - any tips would be much appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Nov 2010 10:15:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55086#M4337</guid>
      <dc:creator>LeeMusto</dc:creator>
      <dc:date>2010-11-29T10:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select features by subtype</title>
      <link>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55087#M4338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well you can &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;iterate over the feature classes, &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; use a cursor to get a set of the values in the subtype field&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; iterate over the values in the set &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select by the value &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureclasstofeatureclass the selection.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Nov 2010 12:13:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55087#M4338</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2010-11-29T12:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select features by subtype</title>
      <link>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55088#M4339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply. I understand how to do it for one subtype using the method you describe, but it's how to iterate over each subtype, without knowing what those subtypes are e.g&amp;nbsp; if I have 10 feature classes, each with 10 subtypes, I want to automatically create 100 new feature classes - some subtypes may have features in them, some may be empty, but I still need it to produce the feature classes. In the meantime, I have created simple tables which contain the subtypes and written a script which iterates through each subtype - which works fine for this set of data, but it would be useful to know so that if I have a new set of data in the future I did not have to manually create the tables.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Dec 2010 06:48:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55088#M4339</guid>
      <dc:creator>LeeMusto</dc:creator>
      <dc:date>2010-12-06T06:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Select features by subtype</title>
      <link>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55089#M4340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Ah ok. Well you need only to know which field holds the subtype values.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
for FC in listofFC:
&amp;nbsp;&amp;nbsp;&amp;nbsp; s_cursor=arcpy.SearchCursor(FC)
&amp;nbsp;&amp;nbsp;&amp;nbsp; subtypes=[]
&amp;nbsp;&amp;nbsp;&amp;nbsp; for row in s_cursor:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subtypes.append(row.getValue(subtypefield))
&amp;nbsp;&amp;nbsp;&amp;nbsp; subtypes=set(subtypes)
&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in subtypes:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do the stuff you need to for each subtype
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Getting the list of values and then making them a set will take [a,a,a,b,c,v,v,c,b] and make it [a,b,c,v].&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:05:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55089#M4340</guid>
      <dc:creator>ChrisMathers</dc:creator>
      <dc:date>2021-12-10T22:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select features by subtype</title>
      <link>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55090#M4341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand how your script works - I would never have known about the 'Set' function without your reply. I'll give it a try in the near future.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks for your help.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Dec 2010 09:35:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55090#M4341</guid>
      <dc:creator>LeeMusto</dc:creator>
      <dc:date>2010-12-21T09:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Select features by subtype</title>
      <link>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55091#M4342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Lee,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Nothing to do with this particular Python posting, it's just very interesting to find someone with the Musto surname.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you would like to chat - &lt;/SPAN&gt;&lt;A href="mailto:ian.musto@csiro.au"&gt;ian.musto@csiro.au&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Ian&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS Sorry to disturb the rest of the thread&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Jan 2011 03:42:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/select-features-by-subtype/m-p/55091#M4342</guid>
      <dc:creator>IanMusto</dc:creator>
      <dc:date>2011-01-05T03:42:53Z</dc:date>
    </item>
  </channel>
</rss>

