<?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: Unique Feature Layers for processing a series of select by locations in Python? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145914#M11379</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also add 'arcpy.env.overwriteOutput = True' at the start of your code.&amp;nbsp; This will overwrite the feature layer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 May 2011 15:22:54 GMT</pubDate>
    <dc:creator>JakeSkinner</dc:creator>
    <dc:date>2011-05-05T15:22:54Z</dc:date>
    <item>
      <title>Unique Feature Layers for processing a series of select by locations in Python?</title>
      <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145910#M11375</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm attempting to perform what I thought would be a simple series of select by locations using arcpy -- e.g. create feature layers for each input feature and select feature and then complete the select by location.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
boundary_file_list = arcpy.ListFeatureClasses()
for boundary_file in boundary_file_list:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(boundary_file, "bnd_lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.MakeFeatureLayer_management(copy_ft, "in_lyr") 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management ("in_lyr", "INTERSECT", "bnd_lyr")
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("in_lyr", output_ft)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But I get an error message on the second round of the processing, as the boundary feature layer already exists:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ExecuteError: Failed to execute. Parameters are not valid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ERROR 000725: Output Layer: Dataset bnd_lyr already exists.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Failed to execute (MakeFeatureLayer).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Does that mean I have create a unique boundary layer name for each iteration of the series? Eg. "bnd_lyr" + str(x) , while x &amp;gt;= 0 and x&amp;lt; 10 ?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there some other way to remove or delete the feature layer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 14:47:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145910#M11375</guid>
      <dc:creator>JamesSnider</dc:creator>
      <dc:date>2011-05-05T14:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Feature Layers for processing a series of select by locations in Python?</title>
      <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145911#M11376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Simple answer, isn't it? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Delete_management...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 14:56:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145911#M11376</guid>
      <dc:creator>JamesSnider</dc:creator>
      <dc:date>2011-05-05T14:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Feature Layers for processing a series of select by locations in Python?</title>
      <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145912#M11377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You could use DeleteFeatures_management ("bnd_lyr") at the end of your loop.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001700000036000000.htm"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001700000036000000.htm&lt;/A&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;That should just remove your feature layer each time.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 14:59:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145912#M11377</guid>
      <dc:creator>MathewCoyle</dc:creator>
      <dc:date>2011-05-05T14:59:47Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Feature Layers for processing a series of select by locations in Python?</title>
      <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145913#M11378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, Mathew. That would also work. I was expecting a simple solution, but couldn't find the tool. Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 15:04:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145913#M11378</guid>
      <dc:creator>JamesSnider</dc:creator>
      <dc:date>2011-05-05T15:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Feature Layers for processing a series of select by locations in Python?</title>
      <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145914#M11379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can also add 'arcpy.env.overwriteOutput = True' at the start of your code.&amp;nbsp; This will overwrite the feature layer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 15:22:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145914#M11379</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2011-05-05T15:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Feature Layers for processing a series of select by locations in Python?</title>
      <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145915#M11380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;How about this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
arcpy.env.overwriteOutput = True
arcpy.MakeFeatureLayer_management(copy_ft, "in_lyr")
boundary_file_list = arcpy.ListFeatureClasses()
for boundary_file in boundary_file_list:
&amp;nbsp;&amp;nbsp; arcpy.SelectLayerByLocation_management ("in_lyr", "INTERSECT", boundary_file)
&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management("in_lyr", output_ft)&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:57:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145915#M11380</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T07:57:58Z</dc:date>
    </item>
    <item>
      <title>Re: Unique Feature Layers for processing a series of select by locations in Python?</title>
      <link>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145916#M11381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The overwrite option is a good idea as well. Although, when implementing that approach, I find I need to be carefule to use "arcpy.Exists(output_feature) != True:" to ensure that I don't go overwriting everything...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That could be the simplest solution, if you aren't considered about lossing outputs that have already been created.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 18:57:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/unique-feature-layers-for-processing-a-series-of/m-p/145916#M11381</guid>
      <dc:creator>JamesSnider</dc:creator>
      <dc:date>2011-05-05T18:57:44Z</dc:date>
    </item>
  </channel>
</rss>

