I would like to create a route line based on a point layer. The existing tool does not meet the customer requirement. But using the code snippet below, the start point and end point are always the same. Does it means they point to the same instance? Please help. Thanks.

rows = arcpy.SearchCursor(pntLyr, whereStr, "", "", "STOPA A") 
for row in rows: 

    if (start==True):
        # create the line based on the start_feat.shape and end_feat.shape
        # Before I reassign the start_feat, start_feat and end_feat already point to the same feature now at this point

1 Answer 1


In your else block you're defining both start_feat and end_feat to be the exact same thing. Also, you want to grab row.Shape, not the entire row object.

  • The question is before I reassign the start_feat=row, it already points to the same row as the end_feat does. Or in other way, even I remove the start_feat=row in the else block, the start_feat still changes in the iterate instead it is supposed to point to the first feature
    – Alex
    Commented Jul 24, 2013 at 19:57
  • It's still slightly confusing what you are trying to do. Are you converting all the points to a single polyline?
    – Paul
    Commented Jul 24, 2013 at 20:00
  • The where_clause in the search cursor defines the points on a route. The field STOPA defines the sequence of the points. My problem is that the previous row (the start_feat) and the current row (the end_feat) are the same all the time even before I reassign the start_feat.
    – Alex
    Commented Jul 24, 2013 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.