All you need if you want to run the shortest path (Dirkjtra algorithm) is a basic set if colomns listed in this workshop :
http://workshop.pgrouting.org/chapters/shortest_path.html
You need only one polylines or lines layer. The function assign vertex creates the topology.
source and target are the identifier for the first and last node of each geometry. It is used to build the topology. You have to use the funciton assign_vertex in the link above.
Then you need a colomn that is your cost. Again all explained the document above. All the algorithm except the shooting star crash if cost are negative.
You can use the reverse_cost is you want a cost from source to target and a different cost from target to node.
Algorithms A* and Dirkjtra are from node to node. The example of queries are in the link above. Shooting * goes from segment to segment. Shooting * accepts cost that are negative as a way to prevent one way of a segment to be used.
A* need additionnal fields compared to Dirkjtra, becauses it uses heuristics relying on geography. Shooting * requires even more field, for it can implements turn restrictions. Go through the document.
This website also register other tutos that are not official.
http://ebmgh.com/blog/2009/12/computing-directions-with-pgrouting/
Take it step by step, READ the documentation and for Dirkjtra and A* there is no real difficulty.
Good luck. As for the data, if you can build a topology, you're good to go.
Best Answer
You can get the shortest route between two points using PostGIS with
ST_Distance
(if you want to know the distance) or withST_MakeLine
(for the geometry):If you want to use the network for routing, then you need a network topology. You could try something like pggraph, but
source
andtarget
attributes are required as well.