In osm2po it's possible to create custom routers as the sample router TrafficSignalsRouter, but the costs seem to be added on vertices after the routing.

Is it possible to add these costs on the edges so that I can export them into my postgresql database (1 minute for each traffic signal in this sample)?

(by the way the vertices costs seem to be taken into account because it changes the generated path, but the final cost remains the same in the logs)

1 Answer 1


You are right. The example only calculates virtual costs but leaves real costs untouched. In order to give traffic signals a real impact, you'll have to add them to the edges instead of to vertices. One option is to count the signals on the found path and then add e.g. 1 minute for each or you can modify your data either at runtime or (your request) in the pgRouting table. Therefore enable the pgVertexWriter in the osm2po.config file by removing the leading #. The traffic signals example assigns a clazz-value of 1 for nodes that are traffic signals. You'll find this value in the vertex-table. Now you have the choice to either add this value to the source or target of an edge in the pgRouting-table using sql update queries.

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.