[pgrouting-users] Oneway problem

Espen Isaksen espen.isaksen at gmail.com
Fri Oct 15 07:34:47 EDT 2010


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(
                        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?


More information about the Pgrouting-users mailing list