<div dir="ltr">Hi all,<br><br>I'm using osm data to calculate time distances from one source node to multiple destinations. For this I'm using pgr_kdijkstraCost. Because I found a few results strange, I used pgr_dijkstra (and pgr_astar) to test total distances between a few nodes.<br><br>Given one source and one destination, I used this code to calculate total cost between two nodes <br><br>-----test1<br>select sum(cost) from<br>(SELECT seq, id1 AS node, id2 AS edge, cost FROM pgr_dijkstra('<br>                SELECT gid AS id,<br>                         source::integer,<br>                         target::integer,<br>                         length::double precision AS cost<br>                        FROM ways',<br>                97972,342392, false, false)) as foo;<br><br>----------<br>*column "custo" was calculated using: custo = (60 * length) / (maxspeed_forward)<br><br>The result for test1 is 115 minutes.<br><br>----------<br><br>Using pgr_kdijkstraCost with only one target (node 342392), the code is:<br><br>-----test2<br>SELECT seq, id1 AS source, id2 AS target, cost FROM pgr_kdijkstraCost($$<br>                SELECT gid AS id,<br>                         source::integer,<br>                         target::integer,<br>                         custo::double precision AS cost<br>                        FROM ways, classes c<br>                        WHERE class_id = <a href="http://c.id">c.id</a><br>                         $$,<br>                97972, array[342392], false, false);<br>----------<br>The result of test2 is 66388 minutes! <br><br>Using the same code with over 2 thousand targets, it runs smoothly, with a few strange results - as this one. <br><br>------------------------------------------------------------------<br><br>Perhaps there's something obvious I'm missing.<br><br>Thanks in advance for any help.<br>António<br></div>