[postgis-users] help with a query

Pedro Doria Meunier pdoria at netmadeira.com
Tue Nov 25 06:52:18 PST 2008


Hi Fred,

Thanks for taking an interest :)

Well ... I'd already done it for the one-way streets.
There are 2 scenarios here:
- vehicle routes
- pedestrian routes

So when I'm trying to calculate a route for a vehicle I don't want the 
algorithm to include road_type=22.

Whenever I decide to calculate a pedestrian route it must return all of 
the possible segments.

The wrappers themselves don't allow you to do that ...

BR,
Pedro Doria Meunier

Fred Lehodey wrote:
> Hi Pedro,
> you are calculating the route with all roads and only after you are 
> filtering with the WHERE clause.
>
> IMO, better is to create a field with high costs (Ex:10000) to roads 
> when road_type=22 and length for road_type != 22.
> After that, you can run the function shortest_path() using your new 
> cost field.
>
>
> Fred.
>
>
> On Tue, Nov 25, 2008 at 2:16 AM, Pedro Doria Meunier 
> <pdoria at netmadeira.com <mailto:pdoria at netmadeira.com>> wrote:
>
>     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.
>
>
>     _______________________________________________
>     postgis-users mailing list
>     postgis-users at postgis.refractions.net
>     <mailto:postgis-users at postgis.refractions.net>
>     http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>   



More information about the postgis-users mailing list