Espen,<div><br></div><div>I dont understand why you set both cost and reverse_cost to the same value ?</div><div><br></div><div>Shouldn´t you be setting </div><div>cost = length</div><div>reverse_cost = length + 100000 ?</div>
<div><br></div><div>(or the other way around depening on the one_way value)</div><div><br></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); ">update elveg set cost= length where oneway='FT' ;<br>
update elveg set reverse_cost= length+1000000 where oneway='TF'</span></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;"><br></span></font></div><div>Ricardo</div><div><br></div><div><br><div class="gmail_quote">On Fri, Oct 15, 2010 at 10:54 AM, Espen Isaksen <span dir="ltr"><<a href="mailto:espen.isaksen@gmail.com">espen.isaksen@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I'm sorry Ralf, I do not understand what you mean here. I'll give some<br>
more description of the data to make it more clear from my side.<br>
<br>
This is the edge being a one way street:<br>
<br>
gid | target | source | cost | reverse_cost | oneway<br>
--------+--------+--------+---------+--------------+--------<br>
157332 | 714814 | 714597 | 1 | 1000062 | TF<br>
<br>
<br>
>From my understanding I should be able to create a route in the<br>
direction of the edge, but the reverse_cost should come into play when<br>
I route the opposite direction? An thus make the route go around.<br>
<br>
And the direction is the direction of the geometry right?<br>
<font color="#888888"><br>
Espen<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
<br>
<br>
<br>
On Fri, Oct 15, 2010 at 2:37 PM, Ralf Suhr <<a href="mailto:Ralf.Suhr@itc-halle.de">Ralf.Suhr@itc-halle.de</a>> wrote:<br>
> If the edge in database have the same start- and endnode you need only update<br>
> the reverse_cost column.<br>
><br>
> In case the direction (start-, endnode) are in reversed order the update will<br>
> only on cost column.<br>
><br>
> Am Freitag 15 Oktober 2010 14:23:16 schrieben Sie:<br>
>> But I think I have understood this correctly then. That is why I did this:<br>
>><br>
>> update elveg set cost=length+1000000 where oneway='FT' ;<br>
>> update elveg set reverse_cost=length+1000000 where oneway='TF'<br>
>><br>
>> This should do exactly what you explained.<br>
>><br>
>> However, I wonder if this should concern me?<br>
>> <a href="http://pgrouting.postlbs.org/ticket/212" target="_blank">http://pgrouting.postlbs.org/ticket/212</a><br>
>><br>
>> Espen<br>
>><br>
>> On Fri, Oct 15, 2010 at 2:08 PM, Ralf Suhr <<a href="mailto:Ralf.Suhr@itc-halle.de">Ralf.Suhr@itc-halle.de</a>> wrote:<br>
>> > Hi Espen,<br>
>> ><br>
>> > one edge is defined by to nodes in pgrouting.<br>
>> > You need to match the definition of oneway street to the edge.<br>
>> ><br>
>> > If the direction of edge and oneway street are the same, then only the<br>
>> > reverse_cost must be higher. In case direction from edge are opposite to<br>
>> > oneway street, the reverse_cost become the the cost for driving the<br>
>> > oneway street.<br>
>> ><br>
>> > Gr<br>
>> > Ralf<br>
>> ><br>
>> > Am Freitag 15 Oktober 2010 13:34:47 schrieb Espen Isaksen:<br>
>> >> Hi!<br>
>> >><br>
>> >> I have a feeling there is something I do not understand concerning<br>
>> >> routing with oneway streets, but after hours of testing and googling I<br>
>> >> have to ask you guys on this list.<br>
>> >><br>
>> >> I have a street network for Norway in my database and I have added the<br>
>> >> columns cost and reverse_cost. I have initially set both columns to<br>
>> >> the value of the length of the geometry.<br>
>> >><br>
>> >> Then I updated cost and reverse cost by this:<br>
>> >><br>
>> >> update elveg set cost=length+1000000 where oneway='FT' ;<br>
>> >> update elveg set reverse_cost=length+1000000 where oneway='TF' ;<br>
>> >><br>
>> >> I have this sql running shooting star. The sql is from the FOSS4G<br>
>> >> workshop:<br>
>> >><br>
>> >> SELECT rt.gid, ST_AsGeoJSON(rt.the_geom) AS geojson,<br>
>> >> length(rt.the_geom) AS length, elveg.gid<br>
>> >> FROM elveg,<br>
>> >> (SELECT gid, the_geom<br>
>> >> FROM shootingstar_sp(<br>
>> >> 'elveg',<br>
>> >> 157334,<br>
>> >> 157165,<br>
>> >> 10000, 'cost', true, true)<br>
>> >> ) as rt<br>
>> >> WHERE elveg.gid=rt.gid<br>
>> >><br>
>> >><br>
>> >> What happens is that if I set the cost column high, the route will not<br>
>> >> travel on this road in both directions. And whatever I set<br>
>> >> reverse_cost, there is no changes to the route.<br>
>> >><br>
>> >> Do I need to explain pgrouting to use the reverse_cost column? And why<br>
>> >> is the cost column working both directions?<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>
>> > 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></div>