<?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: Union all shapefiles in a geodatabase in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106186#M8196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcView only allows two FCs to be unioned at a time. Here is some ***untested*** Python code that could serve as a work-around:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#Be carefull to delete any "tmp_*" or "final_union" FCs before you run the code... otherwise those'll get unioned too
import arcpy
arcpy.env.workspace = r"C:\temp\python\test.gdb"
fcList = arcpy.ListFeatureClasses("*", "POLYGON")
i = 0
for fc in fcList:
&amp;nbsp;&amp;nbsp; i = i + 1
&amp;nbsp;&amp;nbsp; if i == 1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unionFcList = [fcList[i-1],fcList&lt;I&gt;]
&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inputTmpFC = "tmp_" + str(i-1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unionFcList = [fcList&lt;I&gt;,inputTmpFC]
&amp;nbsp;&amp;nbsp; outTmpFC = "tmp_" + str(i)
&amp;nbsp;&amp;nbsp; arcpy.Union_analysis(unionFcList, outTmpFC)
&amp;nbsp;&amp;nbsp; arcpy.Delete_managment(inputTmpFC)
arcpy.Rename_managment(outTmpFC, "final_union")&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 06:28:01 GMT</pubDate>
    <dc:creator>ChrisSnyder</dc:creator>
    <dc:date>2021-12-11T06:28:01Z</dc:date>
    <item>
      <title>Union all shapefiles in a geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106182#M8192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have 2806 polygon shapefiles stored in the same geodatabase and I want to union all of them together. So I was wondering how can I do that by using Python script. Thanks a lot.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;SYM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Aug 2012 18:04:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106182#M8192</guid>
      <dc:creator>SuyunMa</dc:creator>
      <dc:date>2012-08-02T18:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Union all shapefiles in a geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106183#M8193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi SYM,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's an example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"

lstFCs = arcpy.ListFeatureClasses("*", "POLYGON")
arcpy.Union_analysis(lstFCs, "Union_FC")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This script is creating a list of all the polygon feature classes, and then passing this list as the input for the Union GP tool.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:27:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106183#M8193</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2021-12-11T06:27:56Z</dc:date>
    </item>
    <item>
      <title>Re: Union all shapefiles in a geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106184#M8194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks a lot. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi SYM,&lt;BR /&gt;&lt;BR /&gt;Here's an example:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
from arcpy import env
env.workspace = r"C:\temp\python\test.gdb"

lstFCs = arcpy.ListFeatureClasses("*", "POLYGON")
arcpy.Union_analysis(lstFCs, "Union_FC")&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;This script is creating a list of all the polygon feature classes, and then passing this list as the input for the Union GP tool.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:27:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106184#M8194</guid>
      <dc:creator>SuyunMa</dc:creator>
      <dc:date>2021-12-11T06:27:58Z</dc:date>
    </item>
    <item>
      <title>Re: Union all shapefiles in a geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106185#M8195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Does ArcView allow more than two inputs to a union?&amp;nbsp; I think that AV only accepts two inputs for intersects and think the same limitation applies to other overlay processes like union.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2012 18:48:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106185#M8195</guid>
      <dc:creator>ChristopherThompson</dc:creator>
      <dc:date>2012-08-22T18:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Union all shapefiles in a geodatabase</title>
      <link>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106186#M8196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ArcView only allows two FCs to be unioned at a time. Here is some ***untested*** Python code that could serve as a work-around:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
#Be carefull to delete any "tmp_*" or "final_union" FCs before you run the code... otherwise those'll get unioned too
import arcpy
arcpy.env.workspace = r"C:\temp\python\test.gdb"
fcList = arcpy.ListFeatureClasses("*", "POLYGON")
i = 0
for fc in fcList:
&amp;nbsp;&amp;nbsp; i = i + 1
&amp;nbsp;&amp;nbsp; if i == 1:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unionFcList = [fcList[i-1],fcList&lt;I&gt;]
&amp;nbsp;&amp;nbsp; else:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; inputTmpFC = "tmp_" + str(i-1)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; unionFcList = [fcList&lt;I&gt;,inputTmpFC]
&amp;nbsp;&amp;nbsp; outTmpFC = "tmp_" + str(i)
&amp;nbsp;&amp;nbsp; arcpy.Union_analysis(unionFcList, outTmpFC)
&amp;nbsp;&amp;nbsp; arcpy.Delete_managment(inputTmpFC)
arcpy.Rename_managment(outTmpFC, "final_union")&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:28:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/union-all-shapefiles-in-a-geodatabase/m-p/106186#M8196</guid>
      <dc:creator>ChrisSnyder</dc:creator>
      <dc:date>2021-12-11T06:28:01Z</dc:date>
    </item>
  </channel>
</rss>

