My goal:

I would like to connect several nodes via the shortest path along a network --> The red nodes in the next image should be connected along the shortest path of the yellow lines. Nodes (red) to be connected via the network (yellow) My approach:

I have tried different v.net modules, such as v.net.steiner directly on the nodes and the network file --> This doesn't seem like the shortest way along the lines to connect the nodes. Connection generated with v.net.steiner Connection generated with v.net.steiner --> not the shortest path

My tried solutions:

  • v.clean (snap) to close possible small gaps in the topology
  • add length per line segment via field calculator and use this as a 'weight' in v.net modules
  • use other v.net modules (e.g., v.allpairs, v.net.path)

My impression:

I think all modules consider the shortest path from line intersection to line intersection in the general direction to the next node. As a consequence, nodes are connected via short line segments that might not result in the overall shortest path (see 3rd image).

My question:

Which module/approach would connect the nodes via the overall shortest path?


I think I found an answer myself.

The problem seems to be the topology of my network file. If I apply v.clean (snap) followed by v.clean (break or bpol), the nodes can be connected via v.net.steiner or v.net.allpairs as intended. Before, I didn't apply v.clean (break or bpol) after v.clean (snap).

The only disadvantage of this solution is the long processing time for cleaning the topology of the entire network file (especially for v.clean (snap)).

A little unclear to me is the difference in v.clean break and bpol, and whether v.net.steiner is the optimal module to create the shortest path in this case.

Nodes (red) connected via v.net.steiner (yellow) along network (blue)


I think the difference between the tool parameters bpol and break in v.clean is the following:

  • break creates a new segment at each line intersection (one line belongs to one segment only) --> higher feature count (figure 1)
  • bpol creates polygons from the lines (one line can belong to several neighboring polygons) --> lower feature count (figure 2)

Figure 1 - v.clean break Figure 2 - v.clean bpol

  • Thanks for sharing the solution! If you are some doubts about the modules that you reported above, maybe the best would be asking a new separate question for attracting more potential answers. – mgri May 10 '17 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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