I'm having problems creating the last line from a list of coordinates that I have. I have a text file with coordinate data with a X, Y, and a Line ID (LID). I read the file and inserted each attribute into a coordsList. CoordsList has 234 coordinates with an [LID, X, Y] here is my code looping through the list and inserting each set of coordinates for one line into the feature class.
lineCursor = arcpy.da.InsertCursor(lineFC, ["SHAPE@"]) id = -1 #id to identify if which points go to which lines for coords in coordsList: if id == -1: id = coords if id != coords: lineCursor.insertRow([arcpy.Polyline(lineArray)]) lineArray.removeAll() lineArray.add(arcpy.Point(coords, coords, ID=coords)) id = coords lineCursor.insertRow([arcpy.Polyline(lineArray)]) del lineCursor
What am I missing? The feature class is populated correctly until the last line. Then only one of the coordinates is capture so lineArray doesn't contain two coordinates to create the line. There is a record with no geometry? Any direction would be much appreciated.