Forum #18 - Topic #72 - Message List
Hello,
First congratulations for this great extension :) I really appreciate using it !
I tried Dijkstra and A* and they work perfectly. This is a part of the result (vertex_id, edge_id, cost):
18342 321282 176.193824495232 18332 228728 19.452236052737 . . . 99281 257281 161.350922549095 49630 192476 38.0549508277757 49625 -1 0
Then I wanted to try shooting_star (in order to add later some turning constraints). For now the columns rule and to_cost are empty.
So I did the following query :
SELECT * FROM shortest_path_shooting_star( 'SELECT edge_id AS id, source_id::int4 as source, target_id::int4 as target, cost, rcost as reverse_cost,x1, y1, x2, y2, rule, to_cost FROM streets_topology', 321282, 192476, false, true);
Notice that the edges are those returned by Dijkstra or A*, yet I doesn't find any path :(
Where did I went wrong using shooting* ?
Thank you for your work and for helping my poor brain to understand how to use that algorithm.
-
Message #274
Tristram,
I stand to be corrected (not much of an experienced user), but from the little experience I gathered, you need vertices not edges.
source: an int4 identifier of the source vertex target: an int4 identifier of the target vertex
http://pgrouting.postlbs.org/wiki/ShootingStar
Hope this helps you ;)
This is how I did mine :
$source = "select give_source('POINT(".$sp.")',1000,200)"; $target = "select give_target('POINT(".$ep.")',1000,200)" ; $sql = "
SELECT gid, astext(the_geom) as wkt, length(the_geom) AS length FROM shootingstar_sp ('streets',
( select gid from streets where source = ( $source ) limit 1 )
,
( select gid from streets where target = ( $target ) limit 1
)
, 5000, 'length', true, true );
Goodluck :)
yancho12/07/07 17:38:24 -
Message #277
Exactly, but way around :)
For Dijkstra and A* you need vertices, and for Shooting* you need edges.
anton12/08/07 13:04:43 -
Message #279
Anotn,
for Shooting * you need edges? So how come the function needs vertices? :S
yancho12/08/07 18:31:28 -
Message #284
What do you mean?
Dijkstra and A* calculate the path from vertex to vertex and they can use only vertices (nodes) and costs between them.
Shooting* calculate the path from edge to edge, can use only edges (links) and it doesn't care about vertices at all (currently it uses vertices only for heurisctic function value calculation).
If you need to use Shooting* in terms of vertices (for example, to start from a vertex and to stop if you reach another one), you need to choose a source or target vertices for both start and end edges (usually we select closest one to the point we want to start or end with).
anton12/10/07 13:11:45

