Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have set pgrouting and inserted my data with osm2pgrouting .

I would like to know how can I find out which way is one way. Also I read that if I assign the reverse_cost of an one way to -1 only the this road is considered as one way, is it true?

share|improve this question
    
Interesting. I would like to know too. –  Naresh Jun 1 '12 at 15:07

2 Answers 2

up vote 1 down vote accepted

http://www.webrian.ch/2011/07/set-up-pgrouting-with-openstreetmap.html describes one possible solution. The challenge is that osm2pgrouting does not import one-way information. The author uses GRASS to find one-ways from the data. This solution sets reverse_cost to -1 to mark one-ways.

In pgRoutingDocs there is "How to handle one-way streets" The idea there is to set the cost against the one-way direction very high (instead of -1).

Note: Only if the reverse parameter is set to true, the algorithms will use the reverse_cost field.

Osm2po, another OSM import tool, handles one-way information better. reverse_cost fields are filled automatically (to a very high value).

share|improve this answer

Thank you for the answer, but I think that something might be wrong:

The osm2pgrouting code (Export2DB.cpp, called by osm2pgrouting.cpp) writes :

        if(way->oneway)
        row_data += TO_STR(way->length*1000000);
    else
        row_data += TO_STR(way->length);

but after exporting france.osm I notice that

franceRouting=> select count (*) from ways where reverse_cost <> length;
count ------- 0 (1 row)

So I guess that the condition (way->oneway) is not precise enough... But "I might be wrong"!

=> Hell I did not send that answer?! In the meantime I forked and modified the osm2pgrouting git repo. for it to consider the "oneway" tag values "true", "1" and "yes"... Maybe some more modifications are to come : the osm wiki states something like 'some ways, like motorways, are automatically considered as oneway edges'. Still, this statement can be taken into account afterwards with a single sql command... HF!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.