<?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: memory error with list in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181455#M13960</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm with Xander, glomming this all into a huge object in memory is probably not a good idea even if you do run 64 bit and and have the addressing space. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're much better off writing the features to disk one by one, or at least buffering (doing a bunch and then inserting a bunch at a time, clearing memory for the next batch) instead of trying to stuff zillions of features into memory....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python normally does this kind of buffering for efficiency when working with much much smaller text files....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Nov 2014 06:59:19 GMT</pubDate>
    <dc:creator>curtvprice</dc:creator>
    <dc:date>2014-11-19T06:59:19Z</dc:date>
    <item>
      <title>memory error with list</title>
      <link>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181453#M13958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am taking lats and longs from .csv and creating polygons I originally used them to make .shp files until I found about the 2GB limit.&lt;/P&gt;&lt;P&gt;So I thought I would use a .gdb for the feature class but I think I am running into another issue with the&lt;/P&gt;&lt;P&gt;featureList I am creating it has a memory error and stops at around 2 mil I believe.&lt;/P&gt;&lt;P&gt;What would be the best approach to create one large feature in a .gdb through a .csv that may have 3 mil or more.&lt;/P&gt;&lt;P&gt;I thought maybe reset the featureList but then lose the index if I append to the attribute table.&lt;/P&gt;&lt;P&gt;Ultimately I may have a need to join the orginal .csv to the feature class through a common index.&lt;/P&gt;&lt;P&gt;Any ideas appreciated I realize I may also be able to solve by using 10.2 with 64 bit however if I need to move to production I can not guarantee all users will have this and I read you would need to make sure of libraries are running 64 as well.&lt;/P&gt;&lt;P&gt;So for now assume Running arcGis 10.0 32bit&lt;/P&gt;&lt;P&gt;ps sorry about the code I do not see a button to format the code have not been on this new forum.&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="python" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14163799088675982 jive_text_macro" jivemacro_uid="_14163799088675982" modifiedtitle="true"&gt;
&lt;P&gt;featureList = []&lt;/P&gt;
&lt;P&gt;coords=([(ullon_val, ullat_val),(urlon_val,urlat_val),&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (lrlon_val,lrlat_val),(lllon_val,lllat_val),(ullon_val, ullat_val)])&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array = arcpy.Array()&lt;/P&gt;
&lt;P&gt;&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; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for x, y in coords:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(arcpy.Point(x, y))&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Add the first point of the array in to close off the polygon&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.add(array.getObject(0))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print array.getObject(0)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Create a Polygon object based on the array of points&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; polygon = arcpy.Polygon(array)&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; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Clear the array for future use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array.removeAll()&lt;/P&gt;
&lt;P&gt;&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; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # Append to the list of Polygon objects&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureList.append(polygon)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print sys.getsizeof(featureList)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ##2097152&amp;nbsp; bytes in 2 megabytes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arcpy.CopyFeatures_management(featureList,"D:/Footprints/process/Fgdb.gdb/test_3")&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # If an error occurred while running a tool print the messages&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print arcpy.GetMessages()&lt;/P&gt;

&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Curtis Price - see &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;Posting Code blocks in the new GeoNet&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 20:31:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181453#M13958</guid>
      <dc:creator>LindseyWood</dc:creator>
      <dc:date>2014-11-18T20:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: memory error with list</title>
      <link>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181454#M13959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you run into memory problems, you can use the arcpy.da.InsertCursor (or arcpy.InsertCursor for 10.0) to insert each feature...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Nov 2014 21:19:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181454#M13959</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2014-11-18T21:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: memory error with list</title>
      <link>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181455#M13960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm with Xander, glomming this all into a huge object in memory is probably not a good idea even if you do run 64 bit and and have the addressing space. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're much better off writing the features to disk one by one, or at least buffering (doing a bunch and then inserting a bunch at a time, clearing memory for the next batch) instead of trying to stuff zillions of features into memory....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Python normally does this kind of buffering for efficiency when working with much much smaller text files....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 06:59:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181455#M13960</guid>
      <dc:creator>curtvprice</dc:creator>
      <dc:date>2014-11-19T06:59:19Z</dc:date>
    </item>
    <item>
      <title>Re: memory error with list</title>
      <link>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181456#M13961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you have to rebuild the entire layer each time? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not keep a "current" version and just update that with new incoming information?&amp;nbsp; It's pretty straight forward to compare two .csv's, extract the differences and use these to update the "current' layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 13:17:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/memory-error-with-list/m-p/181456#M13961</guid>
      <dc:creator>JamesCrandall</dc:creator>
      <dc:date>2014-11-19T13:17:19Z</dc:date>
    </item>
  </channel>
</rss>

