[GIS] How are cost and reverse cost computed in pgrouting

osm2pgroutingpgrouting

I downloaded the nyc osm metro extract from Mapzen. I then used osm2pgrouting to import that data into postgis, pgrouting and now I have all these columns cost and reverse_cost, but I'm not sure how they were computed. I want to do a special form of routing by modifying the cost columns, but first I want to understand how these quantities were computed. Is it based on the length of the streets?

Best Answer

For osm2pgrouting V2.1:

  • length is length of the segment in degree units
  • cost and reverse_cost is the length in degree units. (include the negative values for wrong way)
  • length_m is in meters (there is no cost_m or reverse_cost_m)
  • cost_s and reverse_cost_s is in time: seconds units (using the maxspeed value that is in km/hr transforming it to meters/second and using the length_m)
Related Question