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

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

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!

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&gt;

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

Thank you for your helpful suggestion!
I have used pgRouting algorithm to do this, and got the product I want.

···

2014-04-24 21:53 GMT+08:00 陳彥文 <r01622040@ntu.edu.tw>:

Thank you for your helpful suggestion!
I have used pgRouting algorithm to do this, and got the product I want.

2014-04-18 21:22 GMT+08:00 Stephen Woodbridge <woodbri@swoodbridge.com>:

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


Pgrouting-users mailing list
Pgrouting-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/pgrouting-users

生工所 r01622040 陳彥文