<?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 Add Row to  Existing Point Feature Class in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/add-row-to-existing-point-feature-class/m-p/199580#M15341</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;BR /&gt;I am having difficulty adding a new row to an existing point feature class using the arcpy.da InsertCursor. &lt;BR /&gt;All the fields are populated, except for the ‘Lon’ and ‘Lat’ fields which are given NULL values (‘None’ type).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The existing point feature class was created using arcpy.management.XYTableToPoint. The fc fields are: ['Shape',&lt;BR /&gt;'USGS_ID', 'Date', 'Event_Time', 'Magnitude', 'Place', ‘Lon', ‘Lat', 'Depth', 'Update_Time']. 'Lon' and 'Lat' are type Float.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;In the call to the InsertCursor, the 'Lon' field was replaced with 'SHAPE@X' and the 'Lat' field with 'SHAPE@Y'. &lt;BR /&gt;The 'Shape' field was not included. Input consisted of a tuple of values corresponding to the listed fc fields.&lt;/DIV&gt;&lt;DIV&gt;Sample input:&lt;BR /&gt;new_event_rows = [('ci39400304', '2020-04-22', '07:03:47.740000', 3.690000057220459,'1km S of View Park-Windsor Hills, CA', -118.34950256347656, 33.98899841308594, 11.600000381469727, 1587616153600.0)].&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;My code is as follows:&lt;/DIV&gt;&lt;DIV&gt;total_new_events = len(new_event_rows)&lt;/DIV&gt;&lt;DIV&gt;if total_new_events &amp;gt; 0: # If there are new events to add to the feature class&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(base_fc, ['USGS_ID', 'Date','Event_Time', 'Magnitude', 'Place', 'SHAPE@X', 'SHAPE@Y', &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; &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; &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; &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; &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;&amp;nbsp; 'Depth','Update_Time']) as irows:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = total_new_events - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while index &amp;gt;= 0:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Populate new row of base_fc with element (tuple) of new_event_rows&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; irows.insertRow(new_event_rows[index])&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; index = index - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del irows&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;I would appreciate your helping me to understand how to use the geometry tokens.&lt;/DIV&gt;&lt;DIV&gt;Thank you,&lt;BR /&gt;Aleta March&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Apr 2020 19:11:17 GMT</pubDate>
    <dc:creator>AletaMarch</dc:creator>
    <dc:date>2020-04-23T19:11:17Z</dc:date>
    <item>
      <title>Add Row to  Existing Point Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/add-row-to-existing-point-feature-class/m-p/199580#M15341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;BR /&gt;I am having difficulty adding a new row to an existing point feature class using the arcpy.da InsertCursor. &lt;BR /&gt;All the fields are populated, except for the ‘Lon’ and ‘Lat’ fields which are given NULL values (‘None’ type).&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;The existing point feature class was created using arcpy.management.XYTableToPoint. The fc fields are: ['Shape',&lt;BR /&gt;'USGS_ID', 'Date', 'Event_Time', 'Magnitude', 'Place', ‘Lon', ‘Lat', 'Depth', 'Update_Time']. 'Lon' and 'Lat' are type Float.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;In the call to the InsertCursor, the 'Lon' field was replaced with 'SHAPE@X' and the 'Lat' field with 'SHAPE@Y'. &lt;BR /&gt;The 'Shape' field was not included. Input consisted of a tuple of values corresponding to the listed fc fields.&lt;/DIV&gt;&lt;DIV&gt;Sample input:&lt;BR /&gt;new_event_rows = [('ci39400304', '2020-04-22', '07:03:47.740000', 3.690000057220459,'1km S of View Park-Windsor Hills, CA', -118.34950256347656, 33.98899841308594, 11.600000381469727, 1587616153600.0)].&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;My code is as follows:&lt;/DIV&gt;&lt;DIV&gt;total_new_events = len(new_event_rows)&lt;/DIV&gt;&lt;DIV&gt;if total_new_events &amp;gt; 0: # If there are new events to add to the feature class&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with arcpy.da.InsertCursor(base_fc, ['USGS_ID', 'Date','Event_Time', 'Magnitude', 'Place', 'SHAPE@X', 'SHAPE@Y', &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; &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; &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; &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; &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;&amp;nbsp; 'Depth','Update_Time']) as irows:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; index = total_new_events - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while index &amp;gt;= 0:&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; # Populate new row of base_fc with element (tuple) of new_event_rows&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; irows.insertRow(new_event_rows[index])&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; index = index - 1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; del irows&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;I would appreciate your helping me to understand how to use the geometry tokens.&lt;/DIV&gt;&lt;DIV&gt;Thank you,&lt;BR /&gt;Aleta March&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2020 19:11:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-row-to-existing-point-feature-class/m-p/199580#M15341</guid>
      <dc:creator>AletaMarch</dc:creator>
      <dc:date>2020-04-23T19:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Add Row to  Existing Point Feature Class</title>
      <link>https://community.esri.com/t5/python-questions/add-row-to-existing-point-feature-class/m-p/199581#M15342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;My problem has been resolved. I was trying to use the geometry tokens ('SHAPE@X' and 'SHAPE@Y') to replace the fields containing the floating point X and Y values for 'Lon' and 'Lat'.&amp;nbsp; Wrong tokens and wrong fields!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By 1) using the 'SHAPE@XY' token instead of the 'Shape' field name in the arcpy.da.InsertCursor field list and 2) populating that field with&amp;nbsp; a tuple&amp;nbsp;containing the&amp;nbsp;(Lon, Lat) values, the Point geometry is added.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems so simple now, but as a newcomer to ArcPy, it wasn't clear to me that the 'Shape' field that, to my eye,&amp;nbsp; contained values in the feature class table that looked like the string 'Point', needed to be filled with a tuple of floating point numbers. Lesson learned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aleta March&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Apr 2020 18:45:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/add-row-to-existing-point-feature-class/m-p/199581#M15342</guid>
      <dc:creator>AletaMarch</dc:creator>
      <dc:date>2020-04-30T18:45:34Z</dc:date>
    </item>
  </channel>
</rss>

