[postgis-users] help with a query

Pedro Doria Meunier pdoria at netmadeira.com
Mon Nov 24 18:16:48 PST 2008


Hi guys :) -- a *special* wink to David Techer ;-)

I'm having a bit of trouble figuring out what can I do with the wrapper 
functions of pgRouting... (blush)

The thing is:

I have everything perfectly in place, pgRouting working as it's supposed 
to, but!

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).

So, as to the query itself (basic) 1st try:

SELECT gid, AsBinary(the_geom) AS the_geom
    FROM dijkstra_sp_directed('pt_madeira_roads', 11780, 424, true, true);

Works like a charm except that it returns pedestrian segments (of course).

2nd try:

SELECT rt.gid, AsText(rt.the_geom) AS wkt,
                   length(rt.the_geom) AS length, roads.gid
                FROM my_roads as roads,
                    (SELECT gid, the_geom
                        FROM dijkstra_sp_directed(
                            'my_roads',
                            11780,
                            424,
                            true,true)
                     ) as rt
                WHERE roads.road_type<>22 and roads.gid=rt.gid;

Leaves me with *holes* in the route.

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. ;-)

Already thankful in advance,
Pedro Doria Meunier.





More information about the postgis-users mailing list