Hi Pedro,<div>you are calculating the route with all roads and only after you are filtering with the WHERE clause.</div><div><br></div><div>IMO, better is to create a field with high costs (Ex:10000) to roads when road_type=22 and length for road_type != 22.</div>
<div>After that, you can run the function shortest_path() using your new cost field.</div>
<div><br></div><div><br></div><div>Fred.</div><div><br><br><div class="gmail_quote">On Tue, Nov 25, 2008 at 2:16 AM, Pedro Doria Meunier <span dir="ltr"><<a href="mailto:pdoria@netmadeira.com" target="_blank">pdoria@netmadeira.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi guys :) -- a *special* wink to David Techer ;-)<br>
<br>
I'm having a bit of trouble figuring out what can I do with the wrapper functions of pgRouting... (blush)<br>
<br>
The thing is:<br>
<br>
I have everything perfectly in place, pgRouting working as it's supposed to, but!<br>
<br>
I have a dataset that describes the road type. I want to filter the results provided by pgRouting in a way that it *doesn't* return return pedestrian segments (btw: road_type=22).<br>
<br>
So, as to the query itself (basic) 1st try:<br>
<br>
SELECT gid, AsBinary(the_geom) AS the_geom<br>
   FROM dijkstra_sp_directed('pt_madeira_roads', 11780, 424, true, true);<br>
<br>
Works like a charm except that it returns pedestrian segments (of course).<br>
<br>
2nd try:<br>
<br>
SELECT rt.gid, AsText(rt.the_geom) AS wkt,<br>
                  length(rt.the_geom) AS length, roads.gid<br>
               FROM my_roads as roads,<br>
                   (SELECT gid, the_geom<br>
                       FROM dijkstra_sp_directed(<br>
                           'my_roads',<br>
                           11780,<br>
                           424,<br>
                           true,true)<br>
                    ) as rt<br>
               WHERE roads.road_type<>22 and roads.gid=rt.gid;<br>
<br>
Leaves me with *holes* in the route.<br>
<br>
All of this is, of course, a consequence of my own stupidity and late hours but I'd surely appreciate if some brave soul could look into it. ;-)<br>
<br>
Already thankful in advance,<br>
Pedro Doria Meunier.<br>
<br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net" target="_blank">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br></div>