I have a network with previously calculated and direction-dependent travel time for each edge (speed_fw for drawing direction and speed_bw for against drawing direction). I prepare the network in QGIS as proposed within this answer, i.e. I double the geometry of the network with a forward and backward version of each edge.

The Shortest Path (Point to Point) algorithm outputs a cost field which contains the distance traveled in meters for the shortest path option and the time traveled in decimal hours for the fastest path option. I need distance and duration for both cases. Obtaining the distance for a fastest route is quite simple because the length can just be calculated using the field calculator (when not considering elevation for exact length calculation). But what if I need the time traveled for a shortest route option?

I would like to know if there is a simpler way to do this in QGIS than this workflow:

  1. Compute the shortest route between starting point A and destination point B.
  2. Rename cost column to distance.
  3. Intersect the underlying network (input layer) with the calculated shortest path (overlay layer), resulting in a "network" that only contains all edges of the previously calculated shortest path from A to B.
  4. Compute the fastest route using the intersected layer (using the speed field extracted from speed_fw and speed_bw for the doubled network).
  5. Delete all fields except the cost field for the resulting route layer and rename the field to hours.
  6. Add an hh:mm:ss field for the duration in hours, minutes, and seconds and calculate the value from the decimal hours field using an appropriate formula.
  7. Intersect the original shortest path with the attributively modified fastest path and save it to disk. It now contains the fields start, end, distance, hours, and hh:mm:ss (see screenshot).

enter image description here

In step 3 it is important to not swap input and overlay layers. This leads to wrong results for travel time calculation as the features from the overlay layer are being modified.

1 Answer 1


You could use a routing service like OpenRouteService. You can use it with the ORS Tools QGIS plugin.

  • 1
    Thank you, I will check ORS Tools plugin. However, in this case I want to stick to the basic network analysis tools in QGIS and figure out the best workflow here.
    – winnewoerp
    May 15, 2023 at 7:56

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.