AnsweredAssumed Answered

access geom obj in arcpy.da.SearchCursor with "*" field param

Question asked by kass3 on Feb 12, 2013
Latest reply on Feb 19, 2013 by kass3
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.

def segmentLine(ref,fc,pSegDist):     irows = arcpy.InsertCursor(fc)     fields = arcpy.ListFields(ref)      rows = arcpy.SearchCursor(ref)     for row in rows:         feat = row.shape         if feat.length > pSegDist:             shapeList = segLineShapeList(feat,pSegDist)              for pt in shapeList:                 newRow = irows.newRow()                 for f in fields:                     if f.editable:                         newRow.setValue(f.name,row.getValue(f.name))                 newRow.shape = pt                 irows.insertRow(newRow)         else:             irows.insertRow(row)     del rows,irows

Outcomes