Say I have a road network defined by a table, indicating, for each arc, its ID, and its head and tail node. In other words, my network is defined as a directed graph.
For example, we have two points, A and B, linked by a two-way road ; each way is thus represented by a specific arc. It gives us the following table :
Arc_ID | Head_node | To_node Arc_01 | A | B Arc_02 | B | A
Each node (A and B) has (X,Y) coordinates, so I drew the network using "LINESTRING" in WKT.
The problem is, Arc_01 and Arc_02 lines are overlapping. I am trying to find a way to draw them so that they do not overlap, and that they are drawn in respect with the way traffic flows on them (right-hand driving).
For that, I thought about calculating the normal vector of each arc, and forcing an offset of a certain number of pixels based on that (so that changing the scale of the map doesn't cause the lines to overlap again), but I have no idea on how to implement it, since I am fairly new to QGIS (I have version 2.0.1 installed) and programming in general.