Hi Espen,<div><br></div><div>Have you tried to route with more than two road links, lets say from <meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">157332 to </span><meta http-equiv="content-type" content="text/html; charset=utf-8"><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; ">157334?</span></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">If you try both directions there, does it take two different routes as well?</span></font></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br></span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">The starting points/edges are somtimes the ones, where issues are likely to occur.</span></font></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">Which version of pgRouting do you use?</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><br>

</span></font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;">I mostly use this wrapper function, that usually worked well for me:</span></font></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse;"><meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="https://github.com/pgRouting/pgrouting-contrib/blob/master/wrapper/routing_core_smart.sql">https://github.com/pgRouting/pgrouting-contrib/blob/master/wrapper/routing_core_smart.sql</a></span></font></div>

<div><font class="Apple-style-span" face="arial, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, sans-serif">It takes X/Y of start and end point as parameter, looks for the nearest edge and then splits it into two substrings and selects the right one.</font></div>

<div><font class="Apple-style-span" face="arial, sans-serif">Maybe this wrapper cares better about special cases, because I haven&#39;t had a strange route with it.</font></div><div><font class="Apple-style-span" face="arial, sans-serif"><br>

</font></div><div><font class="Apple-style-span" face="arial, sans-serif">Daniel</font></div><div><font class="Apple-style-span" face="arial, sans-serif"><span class="Apple-style-span" style="border-collapse: collapse; "><br>

</span></font><br><div class="gmail_quote">2010/12/20 Espen Isaksen <span dir="ltr">&lt;<a href="mailto:espen.isaksen@gmail.com">espen.isaksen@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On Mon, Dec 20, 2010 at 11:11 AM, Daniel Kastl &lt;<a href="mailto:daniel@georepublic.de">daniel@georepublic.de</a>&gt; wrote:<br>
&gt; Hi Espen,<br>
&gt; Your projection unit is &quot;meter&quot;, I guess. So if you decrease your bounding<br>
&gt; box to 10, then, there are no other edges in your select than the two you<br>
&gt; want to get as a result.<br>
<br>
</div>Yes that is understandable. Just hoped it would not jump to a<br>
different &quot;shortest path&quot; when I increased the bounding box :-)<br>
<div class="im"><br>
<br>
&gt; But thank you for trying this, because it shows, that your result passes one<br>
&gt; link twice. Could you find out, if the cost of passing edge 157333 twice<br>
&gt; would be higher than taking the &quot;long&quot; way?<br>
<br>
</div>The cost of 15733 is 104.8033 so passing twice would be 209.6066 and<br>
the cost of going around is 229.675.<br>
<br>
If I rearrange the query and do not use the wrapper function I get this result:<br>
<br>
routing=# SELECT * FROM shortest_path_shooting_star(&#39;SELECT gid as id,<br>
source, target, cost, reverse_cost,x1, y1,x2, y2, rule, to_cost FROM<br>
elveg order by id&#39;,157333,157332,true,true);<br>
<br>
 vertex_id | edge_id |       cost<br>
-----------+---------+------------------<br>
    269628 |  157333 |         104.8033<br>
    269630 |  159163 |          62.3978<br>
    266068 |  155337 |          75.4899<br>
    256213 |  155336 |          29.7317<br>
    266065 |  158776 |          62.0563<br>
    269628 |  157332 | 61.7253486704361<br>
(6 rows)<br>
<font color="#888888"><br>
<br>
Espen<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
&gt; Then the search result would be correct, but of course trying to pass one<br>
&gt; edge twice wouldn&#39;t be OK.<br>
&gt; Thank you for reporting this!<br>
&gt; Daniel<br>
&gt;<br>
&gt; 2010/12/20 Espen Isaksen &lt;<a href="mailto:espen.isaksen@gmail.com">espen.isaksen@gmail.com</a>&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi!<br>
&gt;&gt;<br>
&gt;&gt; I am running the following query:<br>
&gt;&gt;<br>
&gt;&gt; SELECT gid<br>
&gt;&gt; FROM shootingstar_sp(&#39;elveg&#39;,157332,157333,100, &#39;cost&#39;, true, true);<br>
&gt;&gt;<br>
&gt;&gt; and I get:<br>
&gt;&gt;<br>
&gt;&gt;  gid<br>
&gt;&gt; --------<br>
&gt;&gt;  157332<br>
&gt;&gt;  157333<br>
&gt;&gt; (2 rows)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; which seems correct. Now if i flip the direction with the this query:<br>
&gt;&gt;<br>
&gt;&gt; SELECT gid<br>
&gt;&gt; FROM shootingstar_sp(&#39;elveg&#39;,157333,157332,100, &#39;cost&#39;, true, true)<br>
&gt;&gt;<br>
&gt;&gt; then I get:<br>
&gt;&gt;<br>
&gt;&gt;  gid<br>
&gt;&gt; --------<br>
&gt;&gt;  157333<br>
&gt;&gt;  159163<br>
&gt;&gt;  155337<br>
&gt;&gt;  155336<br>
&gt;&gt;  158776<br>
&gt;&gt;  157332<br>
&gt;&gt; (6 rows)<br>
&gt;&gt;<br>
&gt;&gt; which is not correct. There should not be any extra costs on the edges:<br>
&gt;&gt;<br>
&gt;&gt;  gid   |       cost       |   reverse_cost   | to_cost | rule<br>
&gt;&gt; --------+------------------+------------------+---------+------<br>
&gt;&gt;  157332 | 61.7253486704361 | 61.7253486704361 |         |<br>
&gt;&gt;  157333 |         104.8033 |         104.8033 |         |<br>
&gt;&gt; (2 rows)<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; &gt;From my understanding I should get 2 rows in both queries. Am I<br>
&gt;&gt; missing something here?<br>
&gt;&gt;<br>
&gt;&gt; If I decrease the bounding box in the second query to 10, then I get<br>
&gt;&gt; this result:<br>
&gt;&gt;<br>
&gt;&gt;  gid<br>
&gt;&gt; --------<br>
&gt;&gt;  157333<br>
&gt;&gt;  157333<br>
&gt;&gt;  157332<br>
&gt;&gt; (3 rows)<br>
&gt;&gt;<br>
&gt;&gt; I thought I should get the same result for a larger bounding box as<br>
&gt;&gt; long as the shortest path(least cost) is within the smallest bounding<br>
&gt;&gt; box?<br>
&gt;&gt;<br>
&gt;&gt; Image of the road network can be seen here:<br>
&gt;&gt; <a href="http://dl.dropbox.com/u/8829/road_network.png" target="_blank">http://dl.dropbox.com/u/8829/road_network.png</a><br>
&gt;&gt;<br>
&gt;&gt; Espen<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Pgrouting-users mailing list<br>
&gt;&gt; <a href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a><br>
&gt;&gt; <a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Georepublic UG &amp; Georepublic Japan<br>
&gt; eMail: <a href="mailto:daniel.kastl@georepublic.de">daniel.kastl@georepublic.de</a><br>
&gt; Web: <a href="http://georepublic.de" target="_blank">http://georepublic.de</a><br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Pgrouting-users mailing list<br>
&gt; <a href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a><br>
&gt; <a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
&gt;<br>
&gt;<br>
_______________________________________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG &amp; Georepublic Japan<br>eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66, 99, 171)" target="_blank">daniel.kastl@georepublic.de</a><br>

Web: <a href="http://georepublic.de/" style="color:rgb(66, 99, 171)" target="_blank">http://georepublic.de</a></span><br>
</div>