I have a list of straight roads segmented which has a unique
"ID". I would like to detect connected lines in the road network and make them in the same direction instead of reversing them one by one. So to simplify my question:
Each line has a beginning point(x1, y1) and an ending point(x2, y2). For instance: if line A's beginning point(x1, y1) or ending point(x2, y2) is equal to line B's beginning point(x3, y3) or ending point(x4, y4), detect those lines and make it in the same direction. It doesn't matter which direction it is as long as they align in the same direction. Since there are thousands of lines, I need a smart way to do this all at once.
I can use the "Reverse direction of geometry" tool in QGIS but it doesn't resolve my issue because I have to do it one by one.
Can you give me some insights please either via any QGIS tool or Python code samples?