osm2pgrouting (#24) - Cost units ? (#211) - Message List

Cost units ?

I have imported openstreetmap data into pgrouting and used the shootingstar approach and got the cost of going from A to B, but the question remains:

what does this floating point result mean?

What does it mean that the cost of going from A to B is: 0.00713177464270596 ? How do I get kilometers from that?

  • Message #757

    Cost can be anything. It depends on what you define as cost, but for the common case it might be the road link length. And the unit of your length might be meter if your data (projection) is meter, and it could be degree if your projection is in degree.

    In your case I guess it is degree.

    • Message #758

      I forgot to answer your second question:

      If your cost (length) is not "meter" you might want to use PostGIS measurement functions to transform the length:  http://postgis.refractions.net/documentation/manual-1.3/ch06.html#id2748244

      You can do this after your shortest path query or you just precalculate it for your complete network.