I'm using pgr_astar
function of PostgreSQL to get the optimal path, and I mentioned that the result should be ordered by seq
:
cur.execute("create table %s as SELECT a.seq, a.id1 AS node, a.id2 AS edge,
b.source, b.target, b.cost, b.reverse_cost, b.km, b.%s, b.%s, b.estimated_time as time, b.ang_elev, b.geom_way
FROM pgr_astar ('SELECT id, source, target, cost as cost, x1, y1, x2, y2, reverse_cost FROM chicago_2po_4pgr', %s, %s, true, true) as a
LEFT JOIN chicago_2po_4pgr as b ON a.id2 = b.id order by seq
" %(nom_table,colonne_cost,colonne_cost_reverse,depart,destination))
And I'm getting this result (sequences are not ordered)
0
.
.
124
125
135
136
137
138
139
140
129
130
131
132
133
134
Any suggestion please? How can I modify this query to get an ordered result.