I am using pgr_ksp for finding multiple paths for single source and destination. I am wondering if 'source' and 'target' in a roads table are unique or not. because when i am doing routing on my road network table and displaying their geometry on the basis of their 'target' value, it is giving me extra link roads everywhere. This is the query i am using
SELECT pt.gid, seq AS route, id1 AS node, id2 AS edge, cost, geom as line
FROM pgr_ksp(
'SELECT gid as id, source::int4, target::int4, length::float8 as cost FROM my_table',
2087, 1428, 2, false
)
as di JOIN my_table pt
ON di.id2 = pt.target
The red color is showing the output of the query. I know there is nothing wrong with the routing result but when i am trying to get the geometry, 'target' value is i think the only way to get it for display
I want the result as i am showing in the 2nd image with Red color, but right now i am getting extra road segments (shown in Green color) because i am choosing to display geometry from target value.
What can I do in order to get a better result?