I have a great number of area geometries, and line- and point-geometries which have a geometric relation to the area. That means that the distance and the orientation of the lines/points to the areas are important.

enter image description here

Now I got a new version of the areas and found that their position and rotation have changed! The result is, that my lines/points doesn’t fit to the (new) areas. Distances and angles are wrong.

enter image description here enter image description here

The areas were transformed very individual, so I can’t transform my line/point features with a single transformation. I also can’t use the simple move and rotate functions from QGIS because the line features are often related to more than one area, if I would move it in order to correct the distance to one area I would destroy its geometric relation to other areas. I can use the really great vertex tool. I select all vertices from the lines which are related to an area …

enter image description here

… and move it from the corner of the old area to the corner of the new area.

enter image description here

In this way I would proceed for each area. But the problem is that the vertex tool only moves my points and vertices. The needed rotation is not possible. You can take the line starting at the corner of the old area as an example. It has a 90 degree angle to the edge of the old area. After transformation it should have a 90 degree angle to the edge of the new area. The selected vertices must be rotated around the corner of the area with an angle (in my case calculated as the difference between the absolute angles of the edges of the new/old areas).

enter image description here enter image description here

My question is: Anyone have any ideas how I can solve this problem? Is there a plugin for it or do you have some code snippets for me, which brings me on the way to create an own plugin function or can you pimp the vertex tool?

  • Please have a look at the join by nearest tool, working with your roads and polygons. – Erik Nov 10 '20 at 9:43

I guess you could achieve that using the geometry generator. Still, I did not fully understand what exactly you want to do.

But as far as I see you want to make a line that:

a) starts at an edge of the new area that

b) has an angle of 90 degrees to one of the lines of the new area rectangle and that

c) goes to the line geometry.

Start with your new area and use make_line, using one of the edges of your rectangle. For the second point, use the function project and combine it with main_angle (to calculate a 90 degree angle for the line) and intersection (to get the point where your connecting line crosses the given line geometry).

See the explanation of these functions in the expression editor for more details. To make the geometry permanent, use the geometry by expression function from the processing toolbox.

  • 2
    Thanks a lot, but I don't want to make a new line. I want to transform all existing lines and points related to one of my areas. See the marked points and vertices in the snapshots from vertex tool. The line from edge of the area was just an example, – Peter Nov 10 '20 at 10:35
  • What is the reason you don't want to create a new line? – Babel Nov 10 '20 at 11:35
  • It is not only that single line I have to transform. There are many lines with many vertices and on this lines are many point geometries. All this comes from a great number of postgis layers which have additional columns for alphanumeric data, foreign keys and and and. I would have to care for copying all this data from the old feature to the new feature taking into account all database constraints .... I feel that this would be much more complicated. – Peter Nov 11 '20 at 10:01

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.