add origin & destination locations from the same row to a route analysis layer

Discussion created by ragmar on Sep 1, 2010
Latest reply on Oct 28, 2010 by bsriramak

I have an excel table with trips where the origin and destination locations are in the same row. I now want to add these locations to a route analysis layer (shortest route analysis) using Python. Each trip has an id. For some trips, more than one row exist (say: the trips has more than one leg, see example).

Do you have an idea how do this with a Python script?

id      leg     origin_x     origin_y    destination_x     destination_y
1       1      x00001      y00001        x00002           y00002
1       2      x00002      y00002        x00003           y00003
1       3      x00003      y00003        x00004           y00004

Note: the origin coordinates of leg 2 and 3 are the same as for the destination of the previous leg.