3

I have 20 or so sight line elements (2-vertex lines) which have their start vertex at a single point - a point element in another layer.

If I move that start point, how can I move all 20 concurrent start vertices with it, leaving the end vertices in the their original place?

I am using QGIS 3.

3

You can do that by enabling the editing of all line layers, enabling the Vertex tool (all layers), and on Snapping toolbar, click Enable Topological Editing.

Here is a screenshot of what you need to enable:

enter image description here

Then you will be able to click on the vertex of shared points and move them at once to a new location:

enter image description here

Final result:

enter image description here

Update

If all the lines are located in the same layer, you need only to Enable Topological Editing. Here is the output:

enter image description here

  • But does this work if all the sightlines are in the same layer? Topological Editing I believe only works between layers. – user3808985 Jul 7 at 3:12
  • @user3808985 Yes it works if all lines are located in the same layer. You need to enable the topological editing. I updated my answer. – ahmadhanb Jul 7 at 4:48
  • Thank you for showing where the "Enable Topological Editing" tool is - it is not in Settings > Options > Digitising > Snapping. With that tool set the multi-element vertex edit does work as we would like it to. – user3808985 Jul 7 at 7:52
  • @user3808985 You are welcome. Glad it worked :) – ahmadhanb Jul 7 at 8:34
2

I don't know if there is a tool to edit multiple features' vertices at once. As a workaround you can create a new line layer which starts from the moved point.

[Tool] Geometry by expression (in Processing Toolbox > Vector geometry)

[Settings]

  • Input layer: your line layer
  • Output geometry type: Line

[Expression]

 make_line(geometry (get_feature_by_id('point', 1)), end_point($geometry))

where your point layer name is point.

enter image description here

  • This does look like a neat way to do what I want. It creates a new temporary layer with the same number of elements as the source sightline layer. However, the geometry of the new elements is all NULL. Building from your idea I also tried get_feature() to get the geometry by attribute, with the same result. The log does not show an error. – user3808985 Jul 7 at 4:34
  • @user3808985 One possibility is that your point layername is not point. Another possibility, the point id is not 1. Or something else. Your dataset information would be helpful. – Kazuhito Jul 7 at 4:40
  • I ran your suggestion in a new environment where the table names had no spaces or underscores and it works, thank you. So it seems that there is a problem with the "Geometry by Expression" tool passing the right names to the underlying tool. Both sets of data are in GPKG databases. – user3808985 Jul 7 at 7:23
  • @user3808985 I'm glad it worked out. As to the spaces and underscores in the layer name, I could not reproduce the issue with my QGIS 3.8.0 / 3.4.9. But it was just a quick test (simply changing point to point x), so it may not be a proper test. You may want to file a bug report. – Kazuhito Jul 7 at 7:49
  • 1
    I am torn between the two presented solutions! amandhanb's solution is all GUI and directly answers the question as I put it. But your answer shows a glimpse of QGIS' gleaming underlying engine and actually produces a better result for me because it makes a temporary layer I can slice and dice with. Forgive me for selecting the other answer as the most appropriate answer to the question. – user3808985 Jul 7 at 8:00

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.