<?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 access geom obj in arcpy.da.SearchCursor with &amp;amp;amp;quot;*&amp;amp;amp;quot; field param in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/access-geom-obj-in-arcpy-da-searchcursor-with-amp/m-p/406067#M31961</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Although I appreciate the new accessibility of fields and field methods in the da cursors in 10.1 via geometry tokens, I can't figure out how to access the geometry object when I use "*" (all) for my fields parameter. If I find the index of "Shape" and then call row[index[shapeIndex]], I get a tuple of coordinates, not the geometry object. It seems only accessible via the token "SHAPE@". I need to use the "*" field parameter because I am inserting new rows into a blank fc after reading rows from an existing with SearchCursor based on these fields, but also need to access the geometry object as input for a different function that spits out new geometry. Here is the old code below. What is the new way to write this? Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def segmentLine(ref,fc,pSegDist): &amp;nbsp;&amp;nbsp;&amp;nbsp; irows = arcpy.InsertCursor(fc) &amp;nbsp;&amp;nbsp;&amp;nbsp; fields = arcpy.ListFields(ref)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(ref) &amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = row.shape &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if feat.length &amp;gt; pSegDist: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shapeList = segLineShapeList(feat,pSegDist)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for pt in shapeList: &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; newRow = irows.newRow() &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; for f in fields: &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; if f.editable: &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; newRow.setValue(f.name,row.getValue(f.name)) &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; newRow.shape = pt &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; irows.insertRow(newRow) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; irows.insertRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp; del rows,irows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Feb 2013 20:14:36 GMT</pubDate>
    <dc:creator>JamieKass</dc:creator>
    <dc:date>2013-02-12T20:14:36Z</dc:date>
    <item>
      <title>access geom obj in arcpy.da.SearchCursor with &amp;amp;quot;*&amp;amp;quot; field param</title>
      <link>https://community.esri.com/t5/python-questions/access-geom-obj-in-arcpy-da-searchcursor-with-amp/m-p/406067#M31961</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Although I appreciate the new accessibility of fields and field methods in the da cursors in 10.1 via geometry tokens, I can't figure out how to access the geometry object when I use "*" (all) for my fields parameter. If I find the index of "Shape" and then call row[index[shapeIndex]], I get a tuple of coordinates, not the geometry object. It seems only accessible via the token "SHAPE@". I need to use the "*" field parameter because I am inserting new rows into a blank fc after reading rows from an existing with SearchCursor based on these fields, but also need to access the geometry object as input for a different function that spits out new geometry. Here is the old code below. What is the new way to write this? Thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;def segmentLine(ref,fc,pSegDist): &amp;nbsp;&amp;nbsp;&amp;nbsp; irows = arcpy.InsertCursor(fc) &amp;nbsp;&amp;nbsp;&amp;nbsp; fields = arcpy.ListFields(ref)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; rows = arcpy.SearchCursor(ref) &amp;nbsp;&amp;nbsp;&amp;nbsp; for row in rows: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; feat = row.shape &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if feat.length &amp;gt; pSegDist: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; shapeList = segLineShapeList(feat,pSegDist)&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for pt in shapeList: &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; newRow = irows.newRow() &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; for f in fields: &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; if f.editable: &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; newRow.setValue(f.name,row.getValue(f.name)) &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; newRow.shape = pt &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; irows.insertRow(newRow) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else: &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; irows.insertRow(row) &amp;nbsp;&amp;nbsp;&amp;nbsp; del rows,irows&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 20:14:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-geom-obj-in-arcpy-da-searchcursor-with-amp/m-p/406067#M31961</guid>
      <dc:creator>JamieKass</dc:creator>
      <dc:date>2013-02-12T20:14:36Z</dc:date>
    </item>
    <item>
      <title>Re: access geom obj in arcpy.da.SearchCursor with "*" field param</title>
      <link>https://community.esri.com/t5/python-questions/access-geom-obj-in-arcpy-da-searchcursor-with-amp/m-p/406068#M31962</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can just use the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;rows = arcpy.da.SearchCursor(fc, ("SHAPE@", "*"))&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This will return a tuple where the first item is the geometry followed by all the fields from the feature class. It will still contain tuple of coordinates like you saw before, but you can just ignore this. We did this because returning the full geometry is slower than just the coordinates of the centroid.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2013 19:52:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-geom-obj-in-arcpy-da-searchcursor-with-amp/m-p/406068#M31962</guid>
      <dc:creator>ChrisFox3</dc:creator>
      <dc:date>2013-02-13T19:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: access geom obj in arcpy.da.SearchCursor with "*" field param</title>
      <link>https://community.esri.com/t5/python-questions/access-geom-obj-in-arcpy-da-searchcursor-with-amp/m-p/406069#M31963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, that makes everything clear.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Feb 2013 17:20:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/access-geom-obj-in-arcpy-da-searchcursor-with-amp/m-p/406069#M31963</guid>
      <dc:creator>JamieKass</dc:creator>
      <dc:date>2013-02-19T17:20:42Z</dc:date>
    </item>
  </channel>
</rss>

