AnsweredAssumed Answered

How do you insert both attributes and geometry with an InsertCursor?

Question asked by DanEvans83 on Mar 4, 2016
Latest reply on Mar 4, 2016 by wwmiller68

I am trying to use an insert cursor to populate several fields with attributes and also the SHAPE field with a multi-part polyline, but I keep getting a "can only concatenate tuple (not "list") to tuple" error. I don't understand, because it works to insert just the SHAPE surrounded by square brackets, and my row from an outer SearchCursor works as a list everywhere else! (Converting to a tuple doesn't work either!).

 

Here is my code:

 

      # Insert the current superstring into the output feature class
      insertCursor2 = arcpy.da.InsertCursor('SuperStrings_temp_out', dissolveFields + ["SHAPE@"])
      multipartPolyline = arcpy.Polyline(superstringPartsArray)
      insertCursor2.insertRow(row + [[multipartPolyline]])
      del insertCursor2

 

'dissolveFields' is the list of fields whose attributes I want to update with 'row', which is the current row of a table of unique combinations (from the summary statistics tool), which has the same fields as in the dissolveFields list.

 

Please help!

Outcomes