I have two sets of lines: Layer A (a planned network) and Layer B (how the network was realized). The course of the lines on those two layers is similar, but not the same and they do not have the same fields. (A has more lines and also lots of attributes I want to keep, B does not) I now need to move the lines on A, so they follow the path of the lines on Layer B as closely as possible, in the areas where they are nearest. I want to achieve this as automated as possible.
I have tried "snap geometries to layer", but this only snaps nodes within a certain distance, without moving the entire line.
I think I may need to create a new layer with "Geometry by expression", and use "overlay_nearest" as an argument, but cannot get the expression right.
So far I tried this with Layer A:
case
when overlay_nearest( 'Layer B')
then $geometry
end
Which only results in a copy of Layer A.
What do I have to replace $geometry
with?
And could I set some kind of buffer, in which Lines from A are aloud to move toward B?
Am I completely off and need to try something different?