I have the following situation:

I want to find the shortest route from A to B through nodes (C,D,E, etc.) with turn directions and road type filtering.

Is there a way to accomplish this using pgRouting? Has anyone done this? I haven't begun developing anything yet, I'm just trying to find out if pgRouting is the way to go.


Update: The algorithm should determine the order of nodes (C,D,E, etc.)

3 Answers 3


I don't think there is a direct way to calculate routes via in-between nodes in pgRouting. You could try to calculate routes from A to C, A to D and so on and write an algorithm yourself using the Dijkstra shortest route algorithm.

Turn directions are not possible (as far as I know), but road type filtering can be done using a condition in the WHERE clause.


In case you still looking for more alternatives, there is another excellent (and fast) package out there called osrm that deserves some attention. I just found it myself, the code can be found on github


Turn-Restricted-Shortest-Path-(TRSP) Gives me expression that it should be working or experimental option in pgRouting

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.