print '\n' pprint.pprint(allData) fieldList = ['SOL1', 'SOL2', 'SOL3', 'SOL4', 'SOL5', 'SOL6', 'SOL7', 'SOL8', 'SOL9', 'SOL10', 'SOL11', 'SOL12', 'DUR1', 'DUR2', 'DUR3', 'DUR4', 'DUR5', 'DUR6', 'DUR7', 'DUR8', 'DUR9', 'DUR10', 'DUR11', 'DUR12'] fc = r'C:\gis\solarTESTING\default.gdb\points' c = arcpy.da.InsertCursor(fc,('SHAPE@XY', fieldList)) for k,v in allData.iteritems(): row =(k,v) c.insertRow(row) del c
Solved! Go to Solution.
fieldList = ['SOL1', 'SOL2', 'SOL3', 'SOL4', 'SOL5', 'SOL6', 'SOL7', 'SOL8', 'SOL9', 'SOL10', 'SOL11', 'SOL12', 'DUR1', 'DUR2', 'DUR3', 'DUR4', 'DUR5', 'DUR6', 'DUR7', 'DUR8', 'DUR9', 'DUR10', 'DUR11', 'DUR12'] fc = r'C:\gis\solarTESTING\default.gdb\points' with arcpy.da.InsertCursor(fc,['SHAPE@XY'] + fieldList) as c: for k,v in allData.iteritems(): row =+ v c.insertRow(row)
Whats the actual error?
Just a guess, should you have a comma instead of a colon in your dictionary?
(420957.9933000002, 4510316.955): [51217.156,
or
(420957.9933000002, 4510316.955), [51217.156,
insertRow (row)A list or tuple of values. The order of values must be in the same order as specified when creating the cursor.
cursorFC = arcpy.da.InsertCursor(fc, ["SHAPE@", "EventDate", "Scale", "InvScale", "Width", "Height"]) polygonGeo = arcpy.Polygon(shapeArray) cursorFC.insertRow([polygonGeo, eventDateTime, eventScale, eventInvScale, eventWidth, eventHeight])
rowsDA = da.InsertCursor(outFC, ['Name', 'Descript', 'Type', 'DateTimeS', 'Elevation', 'SHAPE@X', 'SHAPE@Y', 'SHAPE@Z']) rowsDA.insertRow([trkPoint.name, trkPoint.desc, trkPoint.gpxtype, trkPoint.t, trkPoint.z, trkPoint.x, trkPoint.y, trkPoint.z])
c = arcpy.da.InsertCursor(fc,('SHAPE@XY', 'SOL1', 'SOL2', 'SOL3', 'SOL4', 'SOL5', 'SOL6', 'SOL7', 'SOL8', 'SOL9', 'SOL10', 'SOL11', 'SOL12', 'DUR1', 'DUR2', 'DUR3', 'DUR4', 'DUR5', 'DUR6', 'DUR7', 'DUR8', 'DUR9', 'DUR10', 'DUR11', 'DUR12')) for k,v in allData.iteritems(): #row =(k,v) row =(k,v[0],v[1],v[2],v[3],v[4],v[5],v[6],v[7],v[8], v[9],v[10],v[11],v[12],v[13],v[14],v[15],v[16], v[17],v[18],v[19],v[20],v[21],v[22], v[23]) c.insertRow(row) del c print 'DONE'
fieldList = ['SOL1', 'SOL2', 'SOL3', 'SOL4', 'SOL5', 'SOL6', 'SOL7', 'SOL8', 'SOL9', 'SOL10', 'SOL11', 'SOL12', 'DUR1', 'DUR2', 'DUR3', 'DUR4', 'DUR5', 'DUR6', 'DUR7', 'DUR8', 'DUR9', 'DUR10', 'DUR11', 'DUR12'] fc = r'C:\gis\solarTESTING\default.gdb\points' with arcpy.da.InsertCursor(fc,['SHAPE@XY'] + fieldList) as c: for k,v in allData.iteritems(): row =+ v c.insertRow(row)