I'm using pgRouting to find the least congested path using time as the cost metric. I am using average speed between two nodes to calculate time taken to travel in a segment. In pgRouting there is a forward cost and reverse cost. I have created tables to each and every edge to maintain reverse and forward speeds. How can I recognize whether a vehicle is travelling in forward direction or the reverse direction in sever side? I'm using postgreSQL as my database
1 Answer
Normally the direction is determined by the order of the coordinates in the linestring.
(You pass the first coordinate before going to the second)