Thank you @Jofban and thank you @DaveF! Especially for your incredibly fast reaction!
@Jofban: Thanks for this insight. I hadn’t realized that some ways could be mapped in different directions, but of course, now everything makes sense.
Ok, so I should check the direction of the nodes in adjacent ways… What about relations of type route - Are their member ways ordered?
In other words, in the members property of a relation with type=route, if two ways with role = "" appear next to each other as in the picture below, can I assume that they are adjacent, or should I check that, too?
@DaveF Thanks for the idea! Yes, you are right - For plotting I could just plot each way individually and I’d get the desired result. The reason that I’m importing them as a poly-line (actually, what I’m doing is concatenating all the nodes from the relation’s beginning until the end into a single, long line) is that after plotting I want to be able to e.g. compute a length, or select an arbitrary subsection of the route.
Also thanks for sharing the more concise version of the query. You are right that I don’t need all relations right away, I’ll look into simplifying it!