<?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: postpone creating spatial index? in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/postpone-creating-spatial-index/m-p/205666#M15827</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The append tool allows you to input a whole bunch of feature at once into the append routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If your variable shpList is a real python list like ["Shape1.shp", "Shape2.shp", ...]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then just pass the entire list into Append_management instead of doing it one at a time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Neil&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Oct 2013 09:31:23 GMT</pubDate>
    <dc:creator>NeilAyres</dc:creator>
    <dc:date>2013-10-10T09:31:23Z</dc:date>
    <item>
      <title>postpone creating spatial index?</title>
      <link>https://community.esri.com/t5/python-questions/postpone-creating-spatial-index/m-p/205665#M15826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Gang,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am using python to create and populate a feature class in a file geodatabase.&amp;nbsp; There are many shapefiles involved (ca 500).&amp;nbsp; These are appended to the target output feature class inside a for loop, as such:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;for shp in shpList: &amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.Append_management( shp, outputfc )&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This works fine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However, I think that the Append_management function regenerates the spatial index for the outputfc, after each call (within the loop).&amp;nbsp; If I'm right, this takes about 12 minutes per shapefile in my case, and this amounts to 100 hours of processing time to generate this spatial index, over and over again.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there any way to postpone the generation of the spatial index, until after all of the shapefiles have been loaded?&amp;nbsp; Certainly after they are loaded, I can call:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.AddSpatialIndex_management( outputfc )&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and save my poor CPU from regenerating the spatial index so many times.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Fingers crossed ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Bruce&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 18:18:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/postpone-creating-spatial-index/m-p/205665#M15826</guid>
      <dc:creator>brucesimonson</dc:creator>
      <dc:date>2013-10-09T18:18:18Z</dc:date>
    </item>
    <item>
      <title>Re: postpone creating spatial index?</title>
      <link>https://community.esri.com/t5/python-questions/postpone-creating-spatial-index/m-p/205666#M15827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The append tool allows you to input a whole bunch of feature at once into the append routine.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If your variable shpList is a real python list like ["Shape1.shp", "Shape2.shp", ...]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Then just pass the entire list into Append_management instead of doing it one at a time.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Neil&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 09:31:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/postpone-creating-spatial-index/m-p/205666#M15827</guid>
      <dc:creator>NeilAyres</dc:creator>
      <dc:date>2013-10-10T09:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: postpone creating spatial index?</title>
      <link>https://community.esri.com/t5/python-questions/postpone-creating-spatial-index/m-p/205667#M15828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The append tool allows you to input a whole bunch of feature at once into the append routine.&lt;BR /&gt;If your variable shpList is a real python list like ["Shape1.shp", "Shape2.shp", ...]&lt;BR /&gt;Then just pass the entire list into Append_management instead of doing it one at a time.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Neil&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Exactly right!&amp;nbsp; Cut processing time to 5% in my case.&amp;nbsp; Blessings on you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here's what it took in my case.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;arcpy.CopyFeatures_management( shpList[0], combined_fc ) arcpy.Append_management( shpList[1:], combined_fc )&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The first line creates a feature class in my file geodatabase, by copying the first shapefile in the list "shpList" to my consolidated feature class "combined_fc".&amp;nbsp; The second line appends the remaining shapefiles into this "combined_fc", starting with element "1" (the 2nd in the list), up through the end of the list.&amp;nbsp; The spatial index appears to be created once, after all the shapefiles in the list have been loaded.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Excellent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-Bruce&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Oct 2013 18:39:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/postpone-creating-spatial-index/m-p/205667#M15828</guid>
      <dc:creator>brucesimonson</dc:creator>
      <dc:date>2013-10-10T18:39:40Z</dc:date>
    </item>
  </channel>
</rss>

