Hi Nguyen,<br><br>If I have understood you right you are already able to get the shortest path using pgrouting as a set of multilinestrings and you are having problems figuring out how to construct one big linestring from the set of multilinestrings.
<br><br>i.e the order in which you arrange the line segments to get the route.<br><br>We had faced a similar problem with out routing implementation (<a href="http://indiaroads.mapunity.org">http://indiaroads.mapunity.org
</a>).<br><br>the way we solved it is like this.<br><br>We added a reference column to the result dataset which would specify the order in which the linesegments are returned from the postgres so that it can used while drawing up the big line string.
<br><br>The other obvious way to do that would be to paint the individual linesegments one after the other. Though this works fine it doesn't give the visual appeal as the earlier suggestion.<br><br>- Pradeep<br><a href="http://mapunity.org">
http://mapunity.org</a><br><br><br><br><div><span class="gmail_quote">On 9/28/06, <b class="gmail_sendername">anntv</b> <<a href="mailto:anntv84@gmail.com">anntv84@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi Anton A. Patrushev,<br><br>Thanks for your help. But I it's not what I mean.<br><br>My problem here is drawing the shortest path on the map.<br><br>The user clicked on 2 points, but the shortest path begins and ends with 2
<br>nodes. The shortest path between 2 nodes is ok. But it's a matter with the<br>start path (the path contains start point) and the end path (the path<br>contains end point) because the user don't click exactly the available
<br>coordinate on your roads. If both start path and end path are<br>multilinestring which are not straight, how can you draw exactly that path<br>from the user's start clicked point to his end clicked point?<br><br>Thanks,
<br><br><br><br><br>Anton A. Patrushev wrote:<br>><br>> Hi Nguyen<br>><br>> You can use Distance function of PostGIS.<br>> Here is an example:<br>><br>> SELECT Distance(geom_column, GeomFromText('POINT(x y)',
<br>> projection_code)) AS dist<br>>               FROM table_name<br>>               ORDER BY dist LIMIT 1";<br>><br>> where<br>> geom_column - the name of the column which contains geometry;<br>> 'x y' - coordinates of your point divided by space;
<br>> projection_code - the code of projection you're using;<br>> table_name - the name of the table.<br>><br>> It will search in entire table, so it will be nice to apply a filter to<br>> the search, but anyway you'll have an idea.
<br>><br>> Good luck!<br>><br>> Anton A. Patrushev<br>> Software Engineer<br>> Orkney, Inc.<br>> 6F JA-Kyosai Yokohama Building,<br>> 1-2 Kaigandori, Naka, Yokohama 231-0002 JAPAN<br>> Tel 81-45-228-3320 Fax 81-45-228-3321
<br>> <a href="http://www.orkney.co.jp">www.orkney.co.jp</a><br>><br>>> Hi everybody,<br>>><br>>> I'm  doing a project which needs to find a shortest path between two<br>>> user's clicked points. I already  installed successfully  pgRouting.
<br>>><br>>> I use this function:<br>>> SELECT * from shortest_path_astar('SELECT gid as id, source, target,<br>>> length as cost, x1, y1, x2, y2 FROM roads', 3, 7, false, false);<br>>><br>>> But the problem is that I can't identify exactly the start node and
<br>>> end node to find path (How to identify node 3 and node 7?). I already<br>>> have the start point and end point of the user. But they don't select<br>>> correctly the points on my roads. So I can't draw the path correctly
<br>>> on the map (The path begins with their start clicked point and ends<br>>> with their end clicked point)<br>>><br>>> Anybody has experiences with this? Please help me!<br>>><br>>> Thanks so much.
<br>>> _______________________________________________<br>>> postgis-users mailing list<br>>> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>>> 
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>>><br>><br>> _______________________________________________<br>> postgis-users mailing list
<br>> <a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>> <a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">http://postgis.refractions.net/mailman/listinfo/postgis-users
</a><br>><br>><br><br>--<br>View this message in context: <a href="http://www.nabble.com/How-to-identify-start-node-and-end-node-in-shortest_path_astar-when-the-user-click-2-points-on-the-map--tf2349095.html#a6542912">
http://www.nabble.com/How-to-identify-start-node-and-end-node-in-shortest_path_astar-when-the-user-click-2-points-on-the-map--tf2349095.html#a6542912</a><br>Sent from the PostGIS - User mailing list archive at <a href="http://Nabble.com">
Nabble.com</a>.<br><br>_______________________________________________<br>postgis-users mailing list<br><a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users">
http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Pradeep B V