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'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"><<a href="mailto:espen.isaksen@gmail.com">espen.isaksen@gmail.com</a>></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 <<a href="mailto:daniel@georepublic.de">daniel@georepublic.de</a>> wrote:<br>
> Hi Espen,<br>
> Your projection unit is "meter", I guess. So if you decrease your bounding<br>
> box to 10, then, there are no other edges in your select than the two you<br>
> want to get as a result.<br>
<br>
</div>Yes that is understandable. Just hoped it would not jump to a<br>
different "shortest path" when I increased the bounding box :-)<br>
<div class="im"><br>
<br>
> But thank you for trying this, because it shows, that your result passes one<br>
> link twice. Could you find out, if the cost of passing edge 157333 twice<br>
> would be higher than taking the "long" 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('SELECT gid as id,<br>
source, target, cost, reverse_cost,x1, y1,x2, y2, rule, to_cost FROM<br>
elveg order by id',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>
> Then the search result would be correct, but of course trying to pass one<br>
> edge twice wouldn't be OK.<br>
> Thank you for reporting this!<br>
> Daniel<br>
><br>
> 2010/12/20 Espen Isaksen <<a href="mailto:espen.isaksen@gmail.com">espen.isaksen@gmail.com</a>><br>
>><br>
>> Hi!<br>
>><br>
>> I am running the following query:<br>
>><br>
>> SELECT gid<br>
>> FROM shootingstar_sp('elveg',157332,157333,100, 'cost', true, true);<br>
>><br>
>> and I get:<br>
>><br>
>> gid<br>
>> --------<br>
>> 157332<br>
>> 157333<br>
>> (2 rows)<br>
>><br>
>><br>
>> which seems correct. Now if i flip the direction with the this query:<br>
>><br>
>> SELECT gid<br>
>> FROM shootingstar_sp('elveg',157333,157332,100, 'cost', true, true)<br>
>><br>
>> then I get:<br>
>><br>
>> gid<br>
>> --------<br>
>> 157333<br>
>> 159163<br>
>> 155337<br>
>> 155336<br>
>> 158776<br>
>> 157332<br>
>> (6 rows)<br>
>><br>
>> which is not correct. There should not be any extra costs on the edges:<br>
>><br>
>> gid | cost | reverse_cost | to_cost | rule<br>
>> --------+------------------+------------------+---------+------<br>
>> 157332 | 61.7253486704361 | 61.7253486704361 | |<br>
>> 157333 | 104.8033 | 104.8033 | |<br>
>> (2 rows)<br>
>><br>
>><br>
>> >From my understanding I should get 2 rows in both queries. Am I<br>
>> missing something here?<br>
>><br>
>> If I decrease the bounding box in the second query to 10, then I get<br>
>> this result:<br>
>><br>
>> gid<br>
>> --------<br>
>> 157333<br>
>> 157333<br>
>> 157332<br>
>> (3 rows)<br>
>><br>
>> I thought I should get the same result for a larger bounding box as<br>
>> long as the shortest path(least cost) is within the smallest bounding<br>
>> box?<br>
>><br>
>> Image of the road network can be seen here:<br>
>> <a href="http://dl.dropbox.com/u/8829/road_network.png" target="_blank">http://dl.dropbox.com/u/8829/road_network.png</a><br>
>><br>
>> Espen<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>
><br>
><br>
><br>
> --<br>
> Georepublic UG & Georepublic Japan<br>
> eMail: <a href="mailto:daniel.kastl@georepublic.de">daniel.kastl@georepublic.de</a><br>
> Web: <a href="http://georepublic.de" target="_blank">http://georepublic.de</a><br>
><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>
><br>
><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 & 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>