I want to merge lines and fill the gaps between them, but I cannot use the "Join multiple lines"-Plugin because I have to use the Graphical Modeler and in there is the plugin/tool not available. Does anyone know another approach?
2 Answers
Extract start and end points with "Geometry by expression" start_point($geometry)
and end_point($geometry)
as two separate point layers.
Execute "Shortest line between features" twice, with a "Maximum distance" set, one from start to end points, and one for end to start points.
"Merge" the two shortest line layers.
"Delete duplicate geometries".
If you want to - merge the resulting layer with your input layer, I haven't
-
looks great thank you, but can I integrate this in a graphical model builder workflow? Commented Oct 28, 2022 at 14:12
-
1
-
1
-
Actually I cant find the: "shortest line between" algorithm... At first I thought you renamed another algorithm in the graphical modeler, but I cant find another one with the same functions. Im am using QGIS 3.22.10 by the way Commented Oct 31, 2022 at 11:26
-
Try this workflow for the following input
Step 1. Use the "Add autoincremental field" tool
x(centroid($geometry))
was applied for 'Sort expression'
Step 2. "Extract vertices"
Step 3. Apply the "Points to path" geoalgorithm
"AUTO" || "vertex_index"
was used in 'Order expression' and "id"
as 'Path group expression'