[postgis-users] How to identify start node and end node in shortest_path_astar when

Nguyen Thi Van An anntv84 at gmail.com
Thu Sep 28 02:47:25 PDT 2006


Hi Pradeep B V,

I already see your web site:  http://indiaroads.mapunity.org
http://indiaroads.mapunity.org 
But I can't find path between 2 points (one of them is a coordinate on the
road, not the node). My problem is here. I don't know how to handle the
start point and end point if they're not nodes.

Thanks,


Pradeep B V wrote:
> 
> Hi Nguyen,
> 
> 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.
> 
> i.e the order in which you arrange the line segments to get the route.
> 
> We had faced a similar problem with out routing implementation (
> http://indiaroads.mapunity.org).
> 
> the way we solved it is like this.
> 
> 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.
> 
> 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.
> 
> - Pradeep
> http://mapunity.org
> 
> 
> 
> On 9/28/06, anntv <anntv84 at gmail.com> wrote:
>>
>>
>> Hi Anton A. Patrushev,
>>
>> Thanks for your help. But I it's not what I mean.
>>
>> My problem here is drawing the shortest path on the map.
>>
>> The user clicked on 2 points, but the shortest path begins and ends with
>> 2
>> nodes. The shortest path between 2 nodes is ok. But it's a matter with
>> the
>> start path (the path contains start point) and the end path (the path
>> contains end point) because the user don't click exactly the available
>> coordinate on your roads. If both start path and end path are
>> multilinestring which are not straight, how can you draw exactly that
>> path
>> from the user's start clicked point to his end clicked point?
>>
>> Thanks,
>>
>>
>>
>>
>> Anton A. Patrushev wrote:
>> >
>> > Hi Nguyen
>> >
>> > You can use Distance function of PostGIS.
>> > Here is an example:
>> >
>> > SELECT Distance(geom_column, GeomFromText('POINT(x y)',
>> > projection_code)) AS dist
>> >               FROM table_name
>> >               ORDER BY dist LIMIT 1";
>> >
>> > where
>> > geom_column - the name of the column which contains geometry;
>> > 'x y' - coordinates of your point divided by space;
>> > projection_code - the code of projection you're using;
>> > table_name - the name of the table.
>> >
>> > It will search in entire table, so it will be nice to apply a filter to
>> > the search, but anyway you'll have an idea.
>> >
>> > Good luck!
>> >
>> > Anton A. Patrushev
>> > Software Engineer
>> > Orkney, Inc.
>> > 6F JA-Kyosai Yokohama Building,
>> > 1-2 Kaigandori, Naka, Yokohama 231-0002 JAPAN
>> > Tel 81-45-228-3320 Fax 81-45-228-3321
>> > www.orkney.co.jp
>> >
>> >> Hi everybody,
>> >>
>> >> I'm  doing a project which needs to find a shortest path between two
>> >> user's clicked points. I already  installed successfully  pgRouting.
>> >>
>> >> I use this function:
>> >> SELECT * from shortest_path_astar('SELECT gid as id, source, target,
>> >> length as cost, x1, y1, x2, y2 FROM roads', 3, 7, false, false);
>> >>
>> >> But the problem is that I can't identify exactly the start node and
>> >> end node to find path (How to identify node 3 and node 7?). I already
>> >> have the start point and end point of the user. But they don't select
>> >> correctly the points on my roads. So I can't draw the path correctly
>> >> on the map (The path begins with their start clicked point and ends
>> >> with their end clicked point)
>> >>
>> >> Anybody has experiences with this? Please help me!
>> >>
>> >> Thanks so much.
>> >> _______________________________________________
>> >> postgis-users mailing list
>> >> postgis-users at postgis.refractions.net
>> >> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> >>
>> >
>> > _______________________________________________
>> > postgis-users mailing list
>> > postgis-users at postgis.refractions.net
>> > http://postgis.refractions.net/mailman/listinfo/postgis-users
>> >
>> >
>>
>> --
>> View this message in context:
>> 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
>> Sent from the PostGIS - User mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> 
> 
> 
> -- 
> Pradeep B V
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 
> 

-- 
View this message in context: 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#a6543409
Sent from the PostGIS - User mailing list archive at Nabble.com.




More information about the postgis-users mailing list