Valeria Muñoz wrote:
Hi Stephen
thanks for the tip... I read the example and implements it with my data.
Now my problem is :how to rescue the data for instructions,distance,time
etc? ..
how can I know whether to turn right or left?
Assume you have two segments a->b and a->c and we want to evaluate it at a
1) you need to check if segment a->b needs to be flipped end to end.
2) because segments can be curves like highway exit ramps you can not
just use the endpoints, instead you have to use:
ab[npoints], ab[npoints-1] and compute the azimuth of this
ac[1], ac[2] and compute the azimuth of this
3) then based on the change in azimuth you and determine if the route is
changing directions and turning right or left
See postGIS functions:
ST_NumPoints()
ST_pointN()
Reverse()
Azimuth()
-Steve
RG.
2009/1/20 Stephen Woodbridge <[email protected]
<mailto:[email protected]>>
Valeria,
You should really look at the example provided with:
http://pgrouting.postlbs.org/wiki/WorkshopFOSS4G2007
This is what I started with and then made my own modifications. The
above workshop should walk you through how to setup a pgRouting
without my additional hacks which will only confuse you at the moment.
My dd_routing.php is a modified version of ax_routing.php that is
included in the tutorial tarball.
You might also want to read some of these pages if you have not already:
http://www.google.com/search?hl=en&q=pgRouting&btnG=Google+Search
<http://www.google.com/search?hl=en&q=pgRouting&btnG=Google+Search>
Best regards,
-Steve W
Valeria Muñoz wrote:
hi Stephen.. thank for the tips...
I have reviewed the code but can only see the dd.html. can you
send me the dd_routing.php? .
please
thanks for everything
2009/1/19 Stephen Woodbridge <[email protected]
<mailto:[email protected]> <mailto:[email protected]
<mailto:[email protected]>>>
Valeria Muñoz wrote:
frank
thanks for the tips. I use prRouting and create the table
dijsktra_result. Now how can I implement with my mapfile?
, how
deliver the data .. have some sample code?
thanks for your help.
2009/1/19 Frank Warmerdam <[email protected]
<mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>
<mailto:[email protected] <mailto:[email protected]>
<mailto:[email protected] <mailto:[email protected]>>>>
Valeria Muñoz wrote:
Hi
I would like to implement the service "optimum path
between 2
points," can someone help me to be able to
implement it?. The
general idea is that a user picks a point A and
point B and a
display on the map the best route to get from
point A to B.
Valeria,
MapServer itself does not do route calculation. You might
find some
useful pointers on this page:
http://wiki.osgeo.org/wiki/OpenRouter
I think the pgRouting (built on postgres/postgis) is
the best
bet for
integration with MapServer.
So you have various options depending on the client software
you are
using. So here are some ideas for you:
1) put the route into a results table with a unique id, and
pass the
unique id back to the client where it can then request the route
image via a mapserver mapfile the connects to the postgis
database
and requests the layer be drawn with the unique id to select the
appropriate route.
2) make an ajax request to generate the route and return the
polyline as an xml or json object back to the client. The client
then parses the result document and displays the route over
the map.
3) if you use OpenLayers for the client then you can use it
to help
you do 1) as an image, or 1) as a wfs layer, or 2) as a
vector layer.
You can look at the source for my demo page
http://imaptools.com/leaddog/routing/dd.html which does this
with a
modified version of pgRouting (pgRouting does not return
turn-by-turn directions), but you should be able to modify my
code
to work with pgRouting. I wrote a simple php script to proxy the
route request into postgres and to format the results back to the
client.
Look this over and see how far you can get with this. If you get
stuck, ask and I'm sure we can get you moving in the right
direction.
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users