<?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: ModelBuilder union process won't work in Python in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493804#M38726</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dice Tool....&amp;nbsp; Never heard of it, but need to take a look at it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 10 Dec 2019 17:13:31 GMT</pubDate>
    <dc:creator>JoeBorgione</dc:creator>
    <dc:date>2019-12-10T17:13:31Z</dc:date>
    <item>
      <title>ModelBuilder union process won't work in Python</title>
      <link>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493800#M38722</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a series of ModelBuilder models which I am in the process of converting into Python scripts, and in one script I am running into trouble with the union of two large polygon feature classes.&amp;nbsp; The&amp;nbsp;model&amp;nbsp;version has always been able to successfully perform the union; however, when I attempt the same process in Python, I always run into topoengine errors.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I even used a cursor to break down the union process and use smaller subsets of one of the large FCs, and this initially worked through a few iterations before it threw another topoengine error.&amp;nbsp; And even had it run successfully, it would have taken far longer than the MB process (several hours as opposed to less than one hour).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way for me to edit my script so that the union process will work (and work as efficiently) as it does in MB?&amp;nbsp; Thanks in advance for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2019 15:08:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493800#M38722</guid>
      <dc:creator>StephenRhone</dc:creator>
      <dc:date>2019-12-09T15:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: ModelBuilder union process won't work in Python</title>
      <link>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493801#M38723</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;With out seeing your script, it's a little tough to comment on where to make adjustments....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Dec 2019 15:51:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493801#M38723</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-12-09T15:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: ModelBuilder union process won't work in Python</title>
      <link>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493802#M38724</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below is the relevant portion of my code - I'm using an intersect here rather than a union.&amp;nbsp; It takes the territory feature class and a zip code feature class, makes layers of each, then runs through a cursor of each territory, selects the zips that intersect it, runs an intersect on all selected features, then appends them into a combined feature class.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So far this morning, I'm not getting any topoengine errors in Python, though the process is taking far longer than it would using ModelBuilder.&amp;nbsp; And as I mentioned, intersecting or unioning both of the feature classes in their entirety, all at once, does not throw any errors or otherwise run into memory issues when I use MB (and goes much faster).&amp;nbsp;&amp;nbsp;&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="comment token"&gt;# Set up layer of territories and cursor of territory numbers&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# Then iterate through cursor to intersect zips with individual territories&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# This is necessary because intersecting them all at once results in errors&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Intersecting zips with territory boundaries"&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Territories&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Territories_Lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;MakeFeatureLayer_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Zips&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Zip_Lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
TerrCursor &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;da&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SearchCursor&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Territories_Lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'TERRITORY_NUM'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; \
sql_clause &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &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;'ORDER BY TERRITORY_NUM'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; Terr &lt;SPAN class="keyword token"&gt;in&lt;/SPAN&gt; TerrCursor&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
    TerrNum &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; Terr&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;
    TerrStr &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; str&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TerrNum&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    TerrQuery &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"TERRITORY_NUM = "&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; TerrStr
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Territories_Lyr&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; TerrQuery&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByLocation_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Zip_Lyr&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; Territories_Lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    TempTerrZipName &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Terr_"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; TerrStr
    TempTerrZip &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; OutputGDB &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"\\"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; TempTerrZipName
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Intersect_analysis&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;Zip_Lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; Territories_Lyr&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; TempTerrZip&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;not&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Exists&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TerrZip&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;CopyFeatures_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempTerrZip&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; TerrZip&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;else&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt;
        arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Append_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempTerrZip&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; TerrZip&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"NO_TEST"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;TempTerrZip&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Territories_Lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CLEAR_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;SelectLayerByAttribute_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Zip_Lyr&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"CLEAR_SELECTION"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
    arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Compact_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;OutputGDB&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;del&lt;/SPAN&gt; TerrCursor
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Territories_Lyr&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Delete_management&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;Zip_Lyr&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;/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;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:43:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493802#M38724</guid>
      <dc:creator>StephenRhone</dc:creator>
      <dc:date>2021-12-11T21:43:40Z</dc:date>
    </item>
    <item>
      <title>Re: ModelBuilder union process won't work in Python</title>
      <link>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493803#M38725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was able to fix the issue by simply using the Dice tool on both of the feature classes before intersecting them.&amp;nbsp; Afterwards, I dissolved the result based on the ID fields of the original FCs and then used those to rejoin the attribute fields.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Dec 2019 16:31:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493803#M38725</guid>
      <dc:creator>StephenRhone</dc:creator>
      <dc:date>2019-12-10T16:31:50Z</dc:date>
    </item>
    <item>
      <title>Re: ModelBuilder union process won't work in Python</title>
      <link>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493804#M38726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dice Tool....&amp;nbsp; Never heard of it, but need to take a look at it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Dec 2019 17:13:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/modelbuilder-union-process-won-t-work-in-python/m-p/493804#M38726</guid>
      <dc:creator>JoeBorgione</dc:creator>
      <dc:date>2019-12-10T17:13:31Z</dc:date>
    </item>
  </channel>
</rss>

