I have a network project in QGIS:
Where arcs is a LineString layer, but all the arcs must be connected. I was able to detect subnetworks using the Disconnected Islands plugin which populates a NetworkGrp field.
The nodes layer is just the output of Extract Vertices algorithm, and wanted layer is what i need.
The conditions are:
- If there are 3 subnetworks, i need 2 lines connecting them. In general, one line less than the number of groups is needed.
- The lines can go from nearest points of each subnetwork group, without the need of a node there (preferred way, but they can go from one node to another one). Next to find the lines, i can clean the topology to add the required nodes and break the arcs accordingly.
- I need to solve this for a lot of unconnected networks, so i can't do it manually.
- I want to solve it in QGIS (using 3.22 right now), but can use GRASS GIS if needed. Python solutions are also welcome.
- There isn't a distance threshold, i just need to connect all groups in a layer. But i don't want to connect arcs or nodes of the same network subgroup.
- I need new arcs, but if a snap method is the only solution i can accept it.
The arcs layer to test can be downloaded from this link.