<?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 Merging with Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84138#M6644</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope somebody can please help me with a script i am developing below. It buffers an input and then select the features within the buffer but then doesnt do the merge. I assume it is to do with the List i am using as the merge input. When i run this through the python window in ArcMap it seems to work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help will be greatly appreciated as i am quite stuck at the moment and have tried everything i can think of.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os, string, arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Read input parameters from script tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LayersList = string.split(arcpy.GetParameterAsText(0),";")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Site_Boundary = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BufferDistance = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OutputFolderLocation = arcpy.GetParameterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Buffer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Buffer_analysis(Site_Boundary, OutputFolderLocation + "\\" + BufferDistance + "_Buffer.shp", BufferDistance, "FULL", "ROUND", "NONE", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Loop Layers &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for Layer in LayersList:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; # Get filename of layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LayerName = os.path.basename(Layer).strip("'") + "_FL"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; # Process: Make Feature Layer (In, Out)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.MakeFeatureLayer_management(Layer.strip("'"), LayerName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; # Process: Select Layer By Location&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.SelectLayerByLocation_management(LayerName, "INTERSECT", OutputFolderLocation + "\\" + BufferDistance + "_Buffer.shp", "0 Meters", "NEW_SELECTION")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.CopyFeatures_management(LayerName, OutputFolderLocation + "\\" + LayerName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; #Create List and Add Layers to the List&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; L = list ()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; L.append(LayerName)&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; # Process: Merge Selected Features&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.Merge_management(L, OutputFolderLocation + "\\All_Sites.shp")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Jun 2012 17:45:29 GMT</pubDate>
    <dc:creator>JamesMitchell</dc:creator>
    <dc:date>2012-06-22T17:45:29Z</dc:date>
    <item>
      <title>Merging with Python</title>
      <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84138#M6644</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I hope somebody can please help me with a script i am developing below. It buffers an input and then select the features within the buffer but then doesnt do the merge. I assume it is to do with the List i am using as the merge input. When i run this through the python window in ArcMap it seems to work.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any help will be greatly appreciated as i am quite stuck at the moment and have tried everything i can think of.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;James&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;import arcpy, os, string, arcgisscripting&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;#Read input parameters from script tool&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LayersList = string.split(arcpy.GetParameterAsText(0),";")&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Site_Boundary = arcpy.GetParameterAsText(1)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;BufferDistance = arcpy.GetParameterAsText(2)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OutputFolderLocation = arcpy.GetParameterAsText(3)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Buffer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;arcpy.Buffer_analysis(Site_Boundary, OutputFolderLocation + "\\" + BufferDistance + "_Buffer.shp", BufferDistance, "FULL", "ROUND", "NONE", "")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;# Process: Loop Layers &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;for Layer in LayersList:&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; # Get filename of layer&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; LayerName = os.path.basename(Layer).strip("'") + "_FL"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; # Process: Make Feature Layer (In, Out)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.MakeFeatureLayer_management(Layer.strip("'"), LayerName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; # Process: Select Layer By Location&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.SelectLayerByLocation_management(LayerName, "INTERSECT", OutputFolderLocation + "\\" + BufferDistance + "_Buffer.shp", "0 Meters", "NEW_SELECTION")&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.CopyFeatures_management(LayerName, OutputFolderLocation + "\\" + LayerName)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; #Create List and Add Layers to the List&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; L = list ()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; L.append(LayerName)&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; # Process: Merge Selected Features&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; arcpy.Merge_management(L, OutputFolderLocation + "\\All_Sites.shp")&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 17:45:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84138#M6644</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2012-06-22T17:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Merging with Python</title>
      <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84139#M6645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Try:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;L = []&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 18:04:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84139#M6645</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2012-06-22T18:04:33Z</dc:date>
    </item>
    <item>
      <title>Re: Merging with Python</title>
      <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84140#M6646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.Merge_management(";".join(L), OutputFolderLocation + "\\All_Sites.shp")&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Jun 2012 19:03:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84140#M6646</guid>
      <dc:creator>JasonScheirer</dc:creator>
      <dc:date>2012-06-22T19:03:32Z</dc:date>
    </item>
    <item>
      <title>Re: Merging with Python</title>
      <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84141#M6647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;From the &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//001700000055000000" rel="nofollow noopener noreferrer" target="_blank"&gt;help&lt;/A&gt;&lt;SPAN&gt;, it looks like the input list should be comma delimited for merge, not semi-colons. Am I wrong?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;edit: I just tried my way and it works.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;#Create List and Add Layers to the List
 L = []
 L.append(LayerName) 

# Process: Merge Selected Features
 arcpy.Merge_management(L, OutputFolderLocation + "\\All_Sites.shp") &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:13:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84141#M6647</guid>
      <dc:creator>DarrenWiens2</dc:creator>
      <dc:date>2021-12-10T23:13:37Z</dc:date>
    </item>
    <item>
      <title>Re: Merging with Python</title>
      <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84142#M6648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for the replies. I have tried both ways but the merge only contains one layer. Please can you shed any further light on this?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jun 2012 19:58:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84142#M6648</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2012-06-23T19:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Merging with Python</title>
      <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84143#M6649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello again,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have managed to get this to work. I just needed to move the L = list() before the for loop. I assume it kept recreating the list and therefore ended up only containing the last layer from the layerslist.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Jun 2012 20:18:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84143#M6649</guid>
      <dc:creator>JamesMitchell</dc:creator>
      <dc:date>2012-06-23T20:18:20Z</dc:date>
    </item>
    <item>
      <title>Re: Merging with Python</title>
      <link>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84144#M6650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;arcpy.Merge_management(";".join(L), OutputFolderLocation + "\\All_Sites.shp")&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just used this and it seems to work great, thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Nov 2012 12:42:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/merging-with-python/m-p/84144#M6650</guid>
      <dc:creator>NolanGeise</dc:creator>
      <dc:date>2012-11-27T12:42:40Z</dc:date>
    </item>
  </channel>
</rss>

