[pgrouting-users] Oneway problem

Ralf Suhr Ralf.Suhr at itc-halle.de
Fri Oct 15 08:08:07 EDT 2010

Hi Espen,

one edge is defined by to nodes in pgrouting. 
You need to match the definition of oneway street to the edge.

If the direction of edge and oneway street are the same, then only the 
reverse_cost must be higher. In case direction from edge are opposite to 
oneway street, the reverse_cost become the the cost for driving the oneway 


Am Freitag 15 Oktober 2010 13:34:47 schrieb Espen Isaksen:
> Hi!
> I have a feeling there is something I do not understand concerning
> routing with oneway streets, but after hours of testing and googling I
> have to ask you guys on this list.
> I have a street network for Norway in my database and I have added the
> columns cost and reverse_cost. I have initially set both columns to
> the value of the length of the geometry.
> Then I updated cost and reverse cost by this:
> update elveg set cost=length+1000000 where oneway='FT' ;
> update elveg set reverse_cost=length+1000000 where oneway='TF' ;
> I have this sql running shooting star. The sql is from the FOSS4G workshop:
> SELECT rt.gid, ST_AsGeoJSON(rt.the_geom) AS geojson,
> length(rt.the_geom) AS length, elveg.gid
> FROM elveg,
> (SELECT gid, the_geom
> FROM shootingstar_sp(
>                         'elveg',
>                         157334,
>                         157165,
>                         10000, 'cost', true, true)
>                      ) as rt
> WHERE elveg.gid=rt.gid
> What happens is that if I set the cost column high, the route will not
> travel on this road in both directions. And whatever I set
> reverse_cost, there is no changes to the route.
> Do I need to explain pgrouting to use the reverse_cost column? And why
> is the cost column working both directions?
> Espen
> _______________________________________________
> Pgrouting-users mailing list
> Pgrouting-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/pgrouting-users

More information about the Pgrouting-users mailing list