I would like to connect user-selected nodes via a line layer, in which each segment has a certain cost value. The lines should be connected via the least-cost path.
So far, I am using the module grass7:v.net.steiner. I would like to use something similar avoiding:
- one line to be used twice -> to avoid dead-ends in the least-cost path
- sharp edges (>90°) -> to avoid zig-zag detours in the least-cost path
Here are screenshots of problem 1. and 2.:
Problem 1: The red points are the nodes, from which the user selected the yellow ones. These are connected via the red lines based on grass7:v.net.steiner, leading to dead-end parts in the least-cost path.
Question 1: Is there a least-cost module withing the PyQGIS environment, where each path is used only once?
Problem 2: Here, the nodes are not displayed, as the selected nodes are outside of the screenshot area. Again, the selected nodes are connected via the red lines, due to the costs of the lines, the least-cost path takes a detour.
Question 2: Is there a way to penalize sharp edges or to favor line straightness when creating a least-cost path?
So far, I have checked the other grass7:v.net modules, the SAGA least cost path module (which works for raster data only), without much success. I would be glad, for some hints on further ideas I could consider.