Thanks for ur suggestions .. I ll try it out<br><br><div class="gmail_quote">On Fri, Apr 25, 2008 at 10:45 AM, William Temperley &lt;<a href="mailto:willtemperley@gmail.com">willtemperley@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">Hi Matthew,<br>
<br>
<br>
&gt;What I am finding hard to implement is the part where to find the shortest<br>
&gt;distance on the road network. &nbsp;It is taking more or a less a minute there.<br>
&gt;Any idea how I can improve it please?<br>
<br>
Any way in which you can cut down the size of the graph PGRouting<br>
works on will give you a faster calculation - just pass a query<br>
representing a subset of your street data to the shortest path<br>
function, e.g.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;SELECT edge_id FROM shortest_path_astar(&#39;&#39;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SELECT gid AS id,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;source::int4,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;target::int4,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;to_cost as cost,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;reverse_cost,<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x1, y1, x2, y2<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;FROM &#39;||table_name||&#39; where<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(the_geom<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&amp;&amp; &lt;something to cut down the result set&gt;)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#39;&#39;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;,&#39;||start_node.node_id||&#39;,&#39;||end_node.node_id||&#39;, true, true<br>
)<br>
<br>
A while ago I was attempting to precalculate routes between strongly<br>
connected nodes and keeping these in the routing table, then selecting<br>
only streets near the start and end points, plus the relevant<br>
pre-calculated routes and passing these to the A* function, but this<br>
never really got past proof of concept, there being a lot of<br>
complications with the precalculation itself. This way I think you<br>
could get sub-second queries on any sized network.<br>
<br>
Also- I think Shooting* is the slowest method and the only extra you<br>
get over A* is right turn restrictions.<br>
<br>
Hope this helps<br>
<br>
Will<br>
<br>
<br>
</div></div>Hope this helps<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" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Matthew Pulis<br>URL : <a href="http://www.solutions-lab.net">http://www.solutions-lab.net</a><br>MSN : pulis_matthew[@]<a href="http://hotmail.com">hotmail.com</a><br>ICQ : 145951110<br>
Skype : <a href="http://solutions-lab.net">solutions-lab.net</a>