<?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 Export selected polygons in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154525#M11939</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What is the code I need to export the selected set of Polygons?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Jul 2012 13:09:49 GMT</pubDate>
    <dc:creator>DaveJordan1</dc:creator>
    <dc:date>2012-07-31T13:09:49Z</dc:date>
    <item>
      <title>Export selected polygons</title>
      <link>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154525#M11939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What is the code I need to export the selected set of Polygons?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 13:09:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154525#M11939</guid>
      <dc:creator>DaveJordan1</dc:creator>
      <dc:date>2012-07-31T13:09:49Z</dc:date>
    </item>
    <item>
      <title>Re: Export selected polygons</title>
      <link>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154526#M11940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;CopyFeatures_management&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 13:15:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154526#M11940</guid>
      <dc:creator>BruceNielsen</dc:creator>
      <dc:date>2012-07-31T13:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Export selected polygons</title>
      <link>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154527#M11941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If you want to create a new feature class from the selection arcpy.CopyFeatures_management will do it:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.CopyFeatures_management(SelectedFeatures,'afilepath\NewFeatures.shp')&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above presumes the output is a shapefile, if you were copying into a new geodatabase feature class you'd have to set up the reference to the gdb and drop the .shp from the name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you want the selection to go into an existing featureclass the the append tool is probably more what you are looking for.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jul 2012 13:19:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154527#M11941</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-07-31T13:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Export selected polygons</title>
      <link>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154528#M11942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I usually will use the MakeFeatureLayer command to make a layer from a feature class based on a query and then use CopyFeatures to export it out into its own feature class.&amp;nbsp; I have an example below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.MakeFeatureLayer_management(feature, feat_lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(feat_lyr, 'NEW_SELECTION', query)
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByAttribute_management(feat_lyr, 'SUBSET_SELECTION', query3)
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; result = arcpy.GetCount_management(feat_lyr)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Number of selected addresses in the layer: " + str(result)

&amp;nbsp;&amp;nbsp;&amp;nbsp; #Copy selected features to new feature class
&amp;nbsp;&amp;nbsp;&amp;nbsp; if arcpy.Exists(output):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Delete_management(output)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(feat_lyr, output)
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Copied selected features from urban points layer to: " + output&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Caleb&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 08:14:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/export-selected-polygons/m-p/154528#M11942</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-12-11T08:14:26Z</dc:date>
    </item>
  </channel>
</rss>

