Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
share|improve this question

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.

share|improve this answer
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 Jul 24 '13 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 Jul 24 '13 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 Jul 24 '13 at 20:13

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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