<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<pre class="moz-signature" cols="72"><font color="#000000" face="Times New Roman, Times, serif">Thanks for reply. I'm using shooting_star alghorithm. My cost is associated with an edge. Many edge have 'infinity' cost (update.... set cost = 'infinity').</font><font color="#000000" face="Times New Roman, Times, serif"> I definited wrapper function.
I call my function using this sql:
select * from carto_shootingstar('carto_nw', 456824, 450370, 0.1, 'cost_time', 'reverse_cost_time', true, true)
Thanks</font>
[CODE]
DECLARE
        geom_table ALIAS FOR $1;
        sourceid ALIAS FOR $2;
        targetid ALIAS FOR $3;
        delta ALIAS FOR $4;
        cost_column ALIAS FOR $5;
        reverse_cost_column ALIAS FOR $6;
        dir ALIAS FOR $7;
        rc ALIAS FOR $8;
        rec record;
        r record;
path_result record;
v_id integer;
e_id integer;
geom geoms;
        
        srid integer;
        source_x float8;
        source_y float8;
        target_x float8;
        target_y float8;
        
        ll_x float8;
        ll_y float8;
        ur_x float8;
        ur_y float8;
        
        query text;
        id integer;
BEGIN
        
        id :=0;
        FOR rec IN EXECUTE
         'select srid(the_geom) from ' ||
         quote_ident(geom_table) || ' limit 1'
        LOOP
        END LOOP;
        srid := rec.srid;
        
        FOR rec IN EXECUTE
'select x(startpoint(the_geom)) as source_x from ' ||
quote_ident(geom_table) || ' where gid = '||sourceid
LOOP
        END LOOP;
        source_x := rec.source_x;
        
        FOR rec IN EXECUTE
'select y(startpoint(the_geom)) as source_y from ' ||
quote_ident(geom_table) || ' where gid = ' ||sourceid
LOOP
        END LOOP;
        source_y := rec.source_y;
        FOR rec IN EXECUTE
'select x(startpoint(the_geom)) as target_x from ' ||
quote_ident(geom_table) || ' where gid = ' ||targetid
LOOP
        END LOOP;
        target_x := rec.target_x;
        
        FOR rec IN EXECUTE
'select y(startpoint(the_geom)) as target_y from ' ||
quote_ident(geom_table) || ' where gid = ' ||targetid
LOOP
        END LOOP;
        target_y := rec.target_y;
        FOR rec IN EXECUTE 'SELECT CASE WHEN '||source_x||'<'||target_x||
' THEN '||source_x||' ELSE '||target_x||
' END as ll_x, CASE WHEN '||source_x||'>'||target_x||
' THEN '||source_x||' ELSE '||target_x||' END as ur_x'
LOOP
        END LOOP;
        ll_x := rec.ll_x;
        ur_x := rec.ur_x;
        FOR rec IN EXECUTE 'SELECT CASE WHEN '||source_y||'<'||
target_y||' THEN '||source_y||' ELSE '||
target_y||' END as ll_y, CASE WHEN '||
source_y||'>'||target_y||' THEN '||
source_y||' ELSE '||target_y||' END as ur_y'
LOOP
        END LOOP;
        ll_y := rec.ll_y;
        ur_y := rec.ur_y;
        query := 'SELECT gid, the_geom FROM ' ||
'shortest_path_shooting_star(''SELECT gid as id, source::integer, ' ||
'target::integer, '||cost_column||'::double precision as cost, ' ||
'x1::double precision, y1::double precision, x2::double ' ||
'precision, y2::double precision, rule::varchar, ' ||
                                 'to_cost::double precision ';
        
        IF rc THEN query := query || ' , ' || reverse_cost_column || ' as reverse_cost ';
        END IF;
        
        query := query || 'FROM ' || quote_ident(geom_table) || ' where setSRID(''''BOX3D('||
ll_x-delta||' '||ll_y-delta||','||ur_x+delta||' '||
ur_y+delta||')''''::BOX3D, ' || srid || ') && the_geom'', ' ||
quote_literal(sourceid) || ' , ' ||
quote_literal(targetid) || ' , '''||text(dir)||''', '''||text(rc)||''' ),' ||
quote_ident(geom_table) || ' where edge_id = gid ';
        
        FOR path_result IN EXECUTE query
LOOP
geom.gid := path_result.gid;
geom.the_geom := path_result.the_geom;
                 id := id+1;
                 geom.id := id;
RETURN NEXT geom;
END LOOP;
RETURN;
END;
[/CODE]
</pre>
-- <br>
Luca Santaniello<br>
email: <a class="moz-txt-link-abbreviated" href="mailto:luca.santaniello@email.it">luca.santaniello@email.it</a> <br>
phone: +39 3470373994<br>
skype: luca.santaniello<br>
msn: <a class="moz-txt-link-abbreviated" href="mailto:luketto81@hotmail.com">luketto81@hotmail.com</a><br>
<br>
<blockquote cite="mid:4D3886C8.5030408@swoodbridge.com" type="cite">
<blockquote type="cite">Hi all,
<br>
<br>
I use pgrouting 1.02. I have teleatlas table with cost and
reverse cost.
<br>
When I have source cost infinity, my path is not found. Is it
normal?
<br>
Why? If I start my path from source with cost not infinity, path
is found.
<br>
<br>
</blockquote>
<br>
Hi Luca,
<br>
<br>
Please provide more information, I'm a little confused by your
question.
<br>
<br>
Cost is normally associated with an edge.
<br>
What is your source? an edge or a node?
<br>
How are you setting the the cost to infinity? what value are you
using?
<br>
Can you provide the sql query you are using?
<br>
Which solution are you trying? dijkstra, astar, or shootingstar?
<br>
<br>
Thanks,
<br>
-Steve
<br>
_______________________________________________
<br>
Pgrouting-users mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a>
<br>
<br>
</blockquote>
<br>
</body>
</html>