[postgis-users] pgrouting

Daniel Kastl orkney at gmx.de
Wed Dec 10 00:12:53 PST 2008


searchelite schrieb:
>
> Jean David TECHER wrote:
>   
>> Hi
>>
>> Please see http://pgrouting.postlbs.org/ function like:
>> - Shortest Path Dijkstra
>> - Shortest Path Shooting Star
>>
>> We should try to find the nearest edge or vertex from your  
>> point(vehicle or emergency point) before finding the path
>>
>> --david;
>>
>>
>>     
>
> thank you for your reply..
>
> what should i do after finding the nearest edge or vertex? how can i find
> the path? the pgrouting documentation only show the street vertex as the
> source and target
>   
As David said: once you selected the nearest vertex to your start, take
this vertex ID as your start point (source), and take the nearest vertex
ID to your end point as the endpoint (target).

Then use Dijkstra for example:

SELECT * FROM shortest_path('
		SELECT gid as id, 
			 source::integer, 
			 target::integer, 
			 length::double precision as cost 
			FROM ways', 
		10, 20, false, false); 

In this case start point is 10 and end point is 20.
See http://pgrouting.postlbs.org/wiki/WorkshopFOSS4G2008/ch07

Daniel









More information about the postgis-users mailing list