I am struggling with the latest pgrouting & osm2pgrouting V2.

The toolchain is installed on my server without any issues, I tried to install it from github and compile it - and I tried it from a stable repo via aptitude as well. Both show the same problems.

I try to import a chunk of OSM data into my routing DB. The import runs smooth and it looks very promising, but there is no 'to_cost' value filled in. I did calculate it once by hand, but I would like to see the original data from the import. What bothers me most, is thhat after a quick glimpse on the source code I noticed that osm2pgrouting does not do that.

"COPY " + tables_prefix + "ways(gid, class_id, length, x1, y1, x2, y2, osm_id, the_geom, reverse_cost, maxspeed_forward, maxspeed_backward, priority, name) FROM STDIN"

Where is this 'to_cost' assignment?

  • I know that's not the answer but if it's not making difference 4U maybe you could try osm2po?
    – Jendrusk
    Commented May 27, 2014 at 17:02
  • osm2po is not an option at this point...
    – Styp
    Commented May 28, 2014 at 17:56

2 Answers 2


to_cost is not supported by osm2pgrouting. to_cost is needed to use TRSP and model turn restrictions. But osm2pgrouting does not support parsing and import of turn restrictions at the moment. (I don't think osm2po supports this either, at least when it creates the import data for pgRouting.)

Or are you looking for reverse_cost?


I think you have to set 'to_cost' manually. It depends on your presonal preferencies. There is nothing like default 'to_cost' value.

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.