I am trying to plot the shortest path returned by pgRouting. However, I am having some issues. Sometimes it comes out a mess.
I have just joined the coordinates of the edges returned by the shortestpath query. However as mentioned in this link http://underdark.wordpress.com/2011/02/07/a-beginners-guide-to-pgrouting/ it says that it uses the necessary geometries. The path is plotted fine by QGIS. It is mentioned in this line
Therefore, we’ll join the results of the previous query with the network table containing the necessary geometries. Suggestions?
SELECT x1,y1,x2,y2 FROM shortest_path(' SELECT id, source::integer, target::integer, cost::double precision FROM at_2po_4pgr', $start_node, $end_node, false, false) INNER JOIN at_2po_4pgr ON edge_id = at_2po_4pgr.id.
I used osm2po to generate the at_2po_4pgr table which contains the edges, their start and end vertices and other information.
I send the bunch of returned x1,y1,x2,y2 and then join these coordinates. Sometimes the path looks fine but sometimes it's a mess. The path looks fine when I use QGIS. But they have different implementation I guess.
Actually my question is, is it enough to send the start and end points of the edges returned by the query and then join these start and end points of each edge by straight line? Or I am supposed to use the geometry given by multilinestring which I have less idea about
I am trying to actually figure out what the "geom_way" column exactly represents and how to use that in my case. I created a network topology and persisted it to postgresql database using osm2po tool for a certain region. Now I am using pgrouting on it to find the shortest route. I am not sure how this column is used by qgis to display the route. It's just a bunch of number, how can I use it in my case?
I am actually using gpx format file to transfer the shortest path. How can I exploit this geometry and send that information in gpx so that it is displayed nicely.