1

I am able to Visualise the Single Route from Source A to Target B by the following code

in QGIS SQL

"id" in (
SELECT id2 as id
 FROM pgr_dijkstra(
   'SELECT id, source, target, cost FROM ways',
   12746, 12714, false, false
 ) as a left join ways b on a.id2=b.id)

But when I try to load multiple paths (4 in this case) using K-shortest path, Results are segments are scattered all over in different places and I do not see single proper route.

"id" in (
SELECT id2 as id
 FROM pgr_ksp(
   'SELECT id, source, target, cost FROM ways',
   12746, 12714, 4, false
 ) a LEFT JOIN ways b ON (a.id2 = b.id)

I am very beginner to pgrouting, so help me if i am doing something wrong here?

0

1 Answer 1

0

I have found solution to it,

By using the following code, it is possible to visualise all the routes properly

"id" in (
SELECT id3 as id
 FROM pgr_ksp(
   'SELECT id, source, target, cost FROM ways',
   12746, 12714, 4, false
 ) a LEFT JOIN ways b ON (a.id3 = b.id))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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