4

I have a line layer where I have lines that have lines that have the "same" geometry, only reversed. I would like to select only one direction at a time. In the symbology I set an offset and arrows to the line, so I know their direction, but I cannot select them at their apparent position, only at the original geometry, but then I select both. I could select both using the table of contents then remove one from the selection, but I would like to be able to do it by selecting on the map. Also I know I could apply a real offset and transform my lines, select the ones I need, then join back to the original or something similar, but still I would prefer the first way.

Is there any option, solution, plugin that I was unable to find?

On the image the black line is the original geometry and the arrows are the apparent offset positions.

enter image description here

1 Answer 1

1

You can calculate the azimuth (angle from north, in radians) for each line. Reverse lines have different values. Based on this value, you can select the lines using Select by expression. Use an expression like this:

azimuth(
    start_point($geometry),
    end_point($geometry)
)>2

Two lines selected (the bottom selected line is covered by the unselected line going in the other direction: enter image description here

5
  • I understand this idea, but it is possible that this line takes a U-turn and then I would select only the half of the desired ones, and half of the undesired ones. Sorry it might have been me who didn't describe perfectly the problem.
    – 588chm
    Commented May 16, 2023 at 5:24
  • 1
    For a solution to work on your dataset, describe the problem with all relevant details and post a link to a test dataset that fulfills these conditions.
    – Babel
    Commented May 16, 2023 at 5:31
  • Don't understand: you want to select just part of the line? That is not possible, just selecting whole lines. You have to split up the line for that, e.g. using explode lines to create a line from each segment
    – Babel
    Commented May 16, 2023 at 6:22
  • I want to select every line , let's say on the right-hand side of each segment.
    – 588chm
    Commented May 17, 2023 at 5:17
  • Don't understand what you mean. Post sample data and indicate the result you expect.
    – Babel
    Commented May 22, 2023 at 20:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.