<?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: Unable to copy 2 different selected features from the same dataset to a new feature class: in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182911#M14045</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That code looks like it should work.&amp;nbsp;Are you using the Feature Class To Feature Class tool&amp;nbsp;to copy the features? Maybe all of the features match one of those two conditions (intersect roads or Shape_Area &amp;gt;= 40469)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Dec 2018 01:38:38 GMT</pubDate>
    <dc:creator>StephenM</dc:creator>
    <dc:date>2018-12-21T01:38:38Z</dc:date>
    <item>
      <title>Unable to copy 2 different selected features from the same dataset to a new feature class:</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182910#M14044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my script I intent to select by location some features(polygons) from feature class call "opt_area", then I want to select other features from the same feature class using Select by attribute, then copy the selected features to a new feature class, but is not working. What it does is copying the entire feature class, not the features&amp;nbsp; selected by SelectByLocation and&amp;nbsp; SelectByAttribute&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.MakeFeatureLayer_management(opt_areas, opt_areas_layer)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Process: Selecting by Location; Use Selecting by Location to select features that are intersected by roads.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByLocation_management(opt_areas_layer, "INTERSECT", roads, "", "NEW_SELECTION", "") &amp;nbsp;&amp;nbsp;&amp;nbsp;print("Select by location completed")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;# Process: Select by Attribute &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;arcpy.SelectLayerByAttribute_management(opt_areas_layer, "ADD_TO_SELECTION", where_clause="Shape_Area &amp;gt;= &amp;nbsp;&amp;nbsp;&amp;nbsp;40469")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;print("Select by attribute completed")&lt;/P&gt;&lt;P&gt;except:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;print(arcpy.GetMessages())&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2018 14:41:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182910#M14044</guid>
      <dc:creator>GustavoColmenares</dc:creator>
      <dc:date>2018-12-11T14:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to copy 2 different selected features from the same dataset to a new feature class:</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182911#M14045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That code looks like it should work.&amp;nbsp;Are you using the Feature Class To Feature Class tool&amp;nbsp;to copy the features? Maybe all of the features match one of those two conditions (intersect roads or Shape_Area &amp;gt;= 40469)?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Dec 2018 01:38:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182911#M14045</guid>
      <dc:creator>StephenM</dc:creator>
      <dc:date>2018-12-21T01:38:38Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to copy 2 different selected features from the same dataset to a new feature class:</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182912#M14046</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In your code, you first selected those features in your layer that are intersected by roads.&amp;nbsp; Rather than adding to that selection, you want to remove features from the selection&amp;nbsp;where the&amp;nbsp;shape area&amp;nbsp;does &lt;STRONG&gt;&lt;EM&gt;not&lt;/EM&gt;&lt;/STRONG&gt; meet&amp;nbsp;your criteria.&amp;nbsp; Then you can save the selected features.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;try&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;opt_areas&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; opt_areas_layer&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# Process: Selecting by Location; Use Selecting by Location to select features that are intersected by roads.&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;opt_areas_layer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"INTERSECT"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; roads&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NEW_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; None&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Select by location completed"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="comment token"&gt;# Process: Select by Attribute&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;opt_areas_layer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"REMOVE_FROM_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; where_clause&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Shape_Area &amp;lt; 40469"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Select by attribute completed"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;except&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;

&amp;nbsp;&amp;nbsp; &lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;GetMessages&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&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;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:19:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182912#M14046</guid>
      <dc:creator>RandyBurton</dc:creator>
      <dc:date>2021-12-11T09:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to copy 2 different selected features from the same dataset to a new feature class:</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182913#M14047</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Stephen M, thank you for your comment&amp;nbsp; I believe the problem was that I had the wrong variable selected.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Dec 2018 22:50:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182913#M14047</guid>
      <dc:creator>GustavoColmenares</dc:creator>
      <dc:date>2018-12-22T22:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Unable to copy 2 different selected features from the same dataset to a new feature class:</title>
      <link>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182914#M14048</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Randy Burton I made some changes that you recommended and It worked, &lt;BR /&gt;thank you&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 22 Dec 2018 22:50:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unable-to-copy-2-different-selected-features-from/m-p/182914#M14048</guid>
      <dc:creator>GustavoColmenares</dc:creator>
      <dc:date>2018-12-22T22:50:55Z</dc:date>
    </item>
  </channel>
</rss>

