[pgrouting-users] Try to use pgRouting and driving_distance function to do special routing task

Stephen Woodbridge woodbri at swoodbridge.com
Fri Apr 18 06:22:55 PDT 2014


On 4/18/2014 6:35 AM, Heinz Chen wrote:
> Hello, guys, I don't know how to use pgRouting and driving_distance to
> do this special routing, the details I have posted in this forum,
>
> Use PostgreSQL to route in different style
> <http://stackoverflow.com/questions/23098554/use-postgresql-to-route-in-different-style>
>
> Can I just achieve this goal just using pgRouting and driving_distance?
> Or is there another way to do this?
> Please give me some hint to begin with and feel free to give me any
> suggestion, thanks!

I looked at your question and I don't think you can do it with the 
existing driving distance code. You might be able to modify the existing 
code to get it to do what you want. The way the code works is this:

1. we build a graph from the edges
2. we solve the graph using dijkstra's algorithm based on the start node
3. this creates a tree off shortest paths with the start node the root 
of the tree
4. we walk the tree summing the edge lengths from the root to each node 
and emit all the nodes.


For your case you would what to change step four generate a product of 
the edge lengths. I looked briefly at the code but could not spot where 
the cost summing was happening, but it should be reasonable obvious.

If you don't need all cost to all nodes, ie the cost from the start to a 
specific end node then you can use pgr_dijkstra and that will return all 
edges for that shorest path and then you can generate the product from that.

-Steve



More information about the Pgrouting-users mailing list