It is supposed that for using Shooting star function in pgrouting, we need to have RULE and TO_COST fields in our table, but OSM2PO hasn't created those fields. what must i do for OSM2PO takes into consideration the turn restrictions?

1 Answer 1


osm2po exports data compatible with pgRouting's shortestpath and shortestpathastar. Hence turn restrictions are not directly supported. But there is a hidden feature which at least give you some more information: Have a look into the osm2po.config file and search for this line:

#postp.2.class = de.cm.osm2po.plugins.PgVertexWriter

uncomment it by removing the "#" and osm2po will provide a second table of vertices. In this table you'll find a rather informational field called "restrictions". You'll recognize values like this one


9231, 12704, 10841, 12704 denote IDs in the network table. A minus (-) means "NoTurn" a plus (+) means "OnlyTurn" In words: Coming from Segment ID 9231 you must not turn to 12704 and coming from ID 10841 you may only turn to 12704, other combinations in this link are not allowed.

The latter is the most difficult part because you'll have to analyze the entire crossing in order to change OnlyTurns into NoTurns.

In addition these rules only refer to the corresponding vertex (table row).

You see, the only missing part is a small SQL/StoredProcedures which does this job ;-)

  • thank you for your quick and very useful answer. Yoo have opened me a way for going ahead. Thank you again!!! Nov 19, 2012 at 13:08
  • sounds you are going to write this sp in near future ;-) Daniel and I are looking forward to it.
    – Carsten
    Nov 20, 2012 at 19:32
  • 1
    Hi @Carsten! Is this still the current state of affairs?
    – underdark
    Jul 12, 2015 at 17:21
  • 1
    Would be great if somebody could actually share how this is done.
    – gameOne
    Aug 2, 2017 at 14:13
  • 1
    Oh, sorry for the slow response. This is a very old thread here. The PgVertexWriter has moved to de.cm.osm2po.plugins.postp.PgVertexWriter. The other information is still correct.
    – Carsten
    Aug 5, 2017 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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