[pgrouting-users] implement directions
Stephen Woodbridge
woodbri at swoodbridge.com
Mon Jul 30 11:09:53 PDT 2012
On 7/30/2012 1:24 PM, Greg Allensworth wrote:
> On 7/30/2012 9:57 AM, Pedro Costa wrote:
>> Em 30-07-2012 17:54, Pedro Costa escreveu:
>>> Hi guys,
>>> Can someone point to me some links or information about implement
>>> driving directions in a pgrouting project?
>> With driving directions i mean information about the select route like
>> "turn right" ...
>
> http://postgis.refractions.net/pipermail/postgis-users/2007-November/017768.html
>
>
> That's what I was going to use as a start, when I get to that phase of
> our routing system. The "left" or "right" would be the difference
> between the two lines' azimuth: if the difference is positive, and more
> than 0.15 radians then it's a slight right, more than .50 radians it's a
> sharp right, if the difference is negative then it's a left, if the
> difference is <0.15 radians in either direction then it's not even a
> turn that I care to mention, ....
>
> But I'm sure someone has developed and documented more of the math here,
> beyond these first steps. I'm sure I'll be asking a few questions along
> these lines, in a few weeks when I get to that phase.
>
Hi Guys,
I have written a lot about this and implemented it for various projects.
Here is a google search that should find most of what I have written:
https://www.google.com/search?q=woodbridge+pgrouting+driving+directions
Start by reading some of these and if you have questions I am willing to
help. The big issue with writing a "generic" solution is that it really
needs to be customized around the data you are using. The pgrouting part
gives you a list of edges, the driving directions starts with this list
of edges and then has to analyze things like are the names the same on
adjacent edges so you can compress the edges into a single maneuver,
when you get to an intersection, do the analysis that Greg mentions to
explicate the instruction, etc.
If you want to see an integrated example of it look at:
http://gis.imaptools.com/routing/leaddog/?zoom=11&lat=33.86651&lon=35.51184&layers=B0TTTF&start=35.493583%2033.826664&stop=35.565174%2033.864285&method=STS&lang=eng
You might think about this as a family of functions like
-- basic pgrouting query, returns edge ids
select * from shortest_path(...);
-- convert route edge ids into maneuvers
select * from maneuvers(shortest_path(...));
-- convert maneuvers into textual directions
select * from explicate(maneuvers(shortest_path(...)));
The maneuvers are generic definition of an instruction. The explication
can then be a table driven instruction generation based on a fixed set
of maneuvers. If you want to have multi language support like my example
above, you just change the table from English template to say French,
German, Arabic, etc.
Hope this helps,
-Steve
More information about the Pgrouting-users
mailing list