I have this table with one row
timestamp_pretty 3.1.2014 9:13timestamp 1,38874E+12msgid 3targetType Ammsi 205533000lat 53.4346long 14.580546posacc 0sog 0cog 319.5shipType CARGOdimBow 68draught 4dimPort 6dimStarboard 5dimStern 12month 1week 1imo 8404446country Belgiumname FAST JULIAI want to make a point feature class from arcpy using insert cursor:
# Read the csvcsv.register_dialect("xls", lineterminator="\n")f = open(incsv, "r")reader = csv.reader(f, dialect = "xls")# Add fields to fcdesc = arcpy.Describe(incsv)for field in desc.fields: arcpy.AddField_management(outfc,field.name,field.type)# the fieldnamesfields = desc.fieldsfieldnames = [field.name for field in fields] # Create InsertCursor.cursor = arcpy.da.InsertCursor(outfc, ['SHAPE@XY'] + fieldnames)count = 0next(reader, None) # skip the headerfor row in reader: if count % 10000 == 0: print "processing row {0}".format(count) + " of " + table Ycoord = row[5] Xcoord = row[6] newrow = [(float(Xcoord), float(Ycoord))] + row[0:] cursor.insertRow([newrow]) count += 1del cursorf.close()But I get this error:
line 130, in cursor.insertRow([newrow])TypeError: sequence size must match size of the rowI've been through SE similar answers and made many tests (days) but to no avail.
أكثر...
timestamp_pretty 3.1.2014 9:13timestamp 1,38874E+12msgid 3targetType Ammsi 205533000lat 53.4346long 14.580546posacc 0sog 0cog 319.5shipType CARGOdimBow 68draught 4dimPort 6dimStarboard 5dimStern 12month 1week 1imo 8404446country Belgiumname FAST JULIAI want to make a point feature class from arcpy using insert cursor:
# Read the csvcsv.register_dialect("xls", lineterminator="\n")f = open(incsv, "r")reader = csv.reader(f, dialect = "xls")# Add fields to fcdesc = arcpy.Describe(incsv)for field in desc.fields: arcpy.AddField_management(outfc,field.name,field.type)# the fieldnamesfields = desc.fieldsfieldnames = [field.name for field in fields] # Create InsertCursor.cursor = arcpy.da.InsertCursor(outfc, ['SHAPE@XY'] + fieldnames)count = 0next(reader, None) # skip the headerfor row in reader: if count % 10000 == 0: print "processing row {0}".format(count) + " of " + table Ycoord = row[5] Xcoord = row[6] newrow = [(float(Xcoord), float(Ycoord))] + row[0:] cursor.insertRow([newrow]) count += 1del cursorf.close()But I get this error:
line 130, in cursor.insertRow([newrow])TypeError: sequence size must match size of the rowI've been through SE similar answers and made many tests (days) but to no avail.
أكثر...