[pgrouting-users] directions problem
Valeria Muñoz
valemunoz at gmail.com
Fri Feb 13 08:19:12 EST 2009
hi daniel
i did try with Shooting* and WORKS!!! .. thanks thanks!!... now my next
problem :) i am using azimuth() for instructions(turn left right etc..) but
i do not how use it, can you help me please?
RG
Query :
SELECT azimuth(startpoint(the_geom),endpoint(the_geom)) as azimuth from
calle where gid = ".$id_gid."
I read in a foro about azimuth() and this says that the result i have to
multiply by 57.29577951. The result is the angle. Now How i know if the user
have to turn left or rigth ..etc?, exist some algoritm? or function?
RG
2009/2/12 Daniel Kastl <kastl at orkney.co.jp>
> Hi Valeria,
>
> When I saw your first screenshot I already guessed that the first
> segment seems to be the problem, but you already could confirm this.
>
> What if you try it with Shooting* function once. It routes from link to
> link and not from node to node. (So you need to use link ID's as start
> and end in the function.)
>
> Daniel
>
>
> Valeria Muñoz schrieb:
> > I found my problem, the problem is the first segment, from the
> > beginning. Query does not consider the first segment, so I took the
> > gid of the segment and obtained the information for route instructions.
> >
> > As a result of the query do not delivery me the first segment (in some
> > cases) not consider if is one-way street.
> >
> > so, now my problem is the first segment. how can i bind to the
> > function to return the first segment informacion for the route?
> >
> > please see the atachment
> >
> > RG
> > PD:sorry for my english :)
> >
> > 2009/2/12 Valeria Muñoz <valemunoz at gmail.com <mailto:valemunoz at gmail.com
> >>
> >
> > I exchanged values,
> >
> > update calle set reverse_cost=reverse_cost + 1000000 WHERE oneway=1;
> > update calle set to_cost=to_cost + 1000000 WHERE oneway=-1;
> >
> > please see the atachment img_01
> >
> > update calle set reverse_cost=reverse_cost + 1000000 WHERE oneway=-1;
> > update calle set to_cost=to_cost + 1000000 WHERE oneway=1;
> > please see the atachment img_02
> >
> > RG
> > 2009/2/12 Stephen Woodbridge <woodbri at swoodbridge.com
> > <mailto:woodbri at swoodbridge.com>>
> >
> > Well, maybe I got the from-to sense backwards. Does it always
> > route the wrong-way down all one-way streets now? If so then,
> > swap the 1 and -1 in the update statements.
> >
> > -Steve
> >
> > Valeria Muñoz wrote:
> >
> > Stephen
> > does not work, please see the attachment
> > RG
> >
> > 2009/2/12 Stephen Woodbridge <woodbri at swoodbridge.com
> > <mailto:woodbri at swoodbridge.com>
> > <mailto:woodbri at swoodbridge.com
> > <mailto:woodbri at swoodbridge.com>>>
> >
> >
> > So set reverse_cost when oneway=1 and cost when oneway=-1
> > Since you have already messed with the values I would
> > do this now:
> >
> > -- make sure everything is re-initiallized
> >
> > UPDATE calle SET to_cost=length(the_geom),
> > reverse_cost=length(the_geom);
> >
> > -- update the oneway costs
> > update calle set reverse_cost=reverse_cost + 1000000
> > WHERE oneway=1;
> > update calle set cost=cost + 1000000 WHERE oneway=-1;
> > vacuum analyze calle;
> >
> > Now see how your test route looks.
> >
> > -Steve
> >
> > Valeria Muñoz wrote:
> >
> > hi Stephen
> > i got
> > "oneway";"count"
> > -1;1451
> > 0;21403
> > 1;2640
> > 0=both ways
> > -1=B->A
> > 1= A->B
> > RG.
> >
> > 2009/2/12 Stephen Woodbridge
> > <woodbri at swoodbridge.com <mailto:woodbri at swoodbridge.com>
> > <mailto:woodbri at swoodbridge.com
> > <mailto:woodbri at swoodbridge.com>>
> > <mailto:woodbri at swoodbridge.com
> > <mailto:woodbri at swoodbridge.com>
> >
> > <mailto:woodbri at swoodbridge.com
> > <mailto:woodbri at swoodbridge.com>>>>
> >
> >
> > Valeria,
> >
> > What do you get for this query:
> >
> > select distinct oneway, count(*) as count from
> > calle group by
> > oneway, order by oneway;
> >
> > If you have a street A------->B then the oneway
> > flag probable
> > needs
> > 3 values. 0 for both ways, 1? for A to B, and
> > maybe 2? for B
> > to A.
> > You need to figure out which values are which.
> >
> > Then you need cost or reverse cost based on the
> > value of oneway.
> >
> > -Steve
> >
> > Valeria Muñoz wrote:
> >
> > hi Daniel, thanks for the link..
> > I did the following:
> > * UPDATE calle SET to_cost=length(the_geom),
> > reverse_cost=length(the_geom); *
> > * *
> > * UPDATE calle SET reverse_cost=reverse_cost
> > + 1000000 WHERE
> > oneway!=0 , oneway!=0 are one way streets. *
> >
> > my query:
> > SELECT edge_id as gid,cost as length
> > FROM
> > shortest_path_astar('SELECT gid AS
> > id,source::int4,
> > target::int4, to_cost::double precision as
> cost,
> > reverse_cost::double precision, x1,y1,x2,y2
> FROM
> > calle',3412,3411,false,true)**
> >
> > this do not works 100%, with some street
> > works with
> > others no...
> > I am missing something?
> > RG
> >
> > 2009/2/11 Daniel Kastl <kastl at orkney.co.jp
> > <mailto:kastl at orkney.co.jp>
> > <mailto:kastl at orkney.co.jp <mailto:kastl at orkney.co.jp
> >>
> > <mailto:kastl at orkney.co.jp
> > <mailto:kastl at orkney.co.jp> <mailto:kastl at orkney.co.jp
> > <mailto:kastl at orkney.co.jp>>>
> > <mailto:kastl at orkney.co.jp
> > <mailto:kastl at orkney.co.jp> <mailto:kastl at orkney.co.jp
> > <mailto:kastl at orkney.co.jp>>
> >
> > <mailto:kastl at orkney.co.jp
> > <mailto:kastl at orkney.co.jp> <mailto:kastl at orkney.co.jp
> > <mailto:kastl at orkney.co.jp>>>>>
> >
> >
> >
> > So I guess pgRouting doesn't know that
> > there is a one
> > way street.
> > You might want to read this:
> >
> > http://pgrouting.postlbs.org/wiki/OneWayStreets
> >
> > Daniel
> >
> >
> > Valeria Muñoz schrieb:
> > > HI!!
> > >
> > > I have a little problem with my
> > routing, the best
> > path from
> > A to
> > > B do not respect the traffic direction.
> > > attached image.
> > >
> > > please check in the example vicente
> > perez rosales
> > street
> > >
> > > Query
> > >
> > > rt.gid,rt.the_geom AS tg,
> > AsText(rt.the_geom) AS wkt,
> > > length(rt.the_geom) AS length,
> > calle.gid FROM calle,
> > (SELECT gid,
> > > the_geom FROM dijkstra_sp_delta(
> > 'calle', 3414, 3406,
> > 3000) ) as rt
> > > WHERE calle.gid=rt.gid;
> > >
> > >
> > > RG
> > >
> > >
> >
> >
> ------------------------------------------------------------------------
> > >
> > >
> >
> >
> ------------------------------------------------------------------------
> > >
> > >
> > _______________________________________________
> > > Pgrouting-users mailing list
> > > Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>>>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>>>>
> >
> > >
> >
> > http://lists.postlbs.org/mailman/listinfo/pgrouting-users
> > >
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Pgrouting-users mailing list
> > Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>
> > <mailto:Pgrouting-users at lists.postlbs.org
> > <mailto:Pgrouting-users at lists.postlbs.org>>>
> >
> > http://lists.postlbs.org/mailman/listinfo/pgrouting-users
> >
> >
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------
> >
> >
> >
> >
> >
> > ------------------------------------------------------------------------
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20090213/d37a2c5f/attachment.html
More information about the Pgrouting-users
mailing list