Thanks Adil,<br>I will take a look on it and let see what I will come up with.<br>Merci<br>Cleber<br><br>P.S. I will keep in touch if I have any doubt if you don't mind.<br><br>------------------------------------<br><br>
<div class="gmail_quote">On Tue, Feb 1, 2011 at 7:12 PM, <span dir="ltr"><<a href="mailto:pgrouting-users-request@lists.osgeo.org">pgrouting-users-request@lists.osgeo.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Send Pgrouting-users mailing list submissions to<br>
<a href="mailto:pgrouting-users@lists.osgeo.org">pgrouting-users@lists.osgeo.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
<a href="mailto:pgrouting-users-request@lists.osgeo.org">pgrouting-users-request@lists.osgeo.org</a><br>
<br>
You can reach the person managing the list at<br>
<a href="mailto:pgrouting-users-owner@lists.osgeo.org">pgrouting-users-owner@lists.osgeo.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Pgrouting-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
1. Re : [pgrouting-users] pgrouting - Driving Direction -<br>
foss4g2010, WORKSHOP (Adil BOUMAZOUED)<br>
<br>
<br>
----------------------------------------------------------------------<br>
<br>
Message: 1<br>
Date: Tue, 1 Feb 2011 18:12:10 +0000<br>
From: Adil BOUMAZOUED <<a href="mailto:boumazoued@gmail.com">boumazoued@gmail.com</a>><br>
Subject: Re : [pgrouting-users] pgrouting - Driving Direction -<br>
foss4g2010, WORKSHOP<br>
To: <a href="mailto:pgrouting-users@lists.osgeo.org">pgrouting-users@lists.osgeo.org</a><br>
Message-ID:<br>
<<a href="mailto:AANLkTimHofmC6TXUgSP-W3pw4DnM8XK9Y%2BBb1kb1K8rP@mail.gmail.com">AANLkTimHofmC6TXUgSP-W3pw4DnM8XK9Y+Bb1kb1K8rP@mail.gmail.com</a>><br>
Content-Type: text/plain; charset="iso-8859-1"<br>
<br>
hi,<br>
i hope this code can help you. it s not complete and not optimised<br>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>
<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>"><br>
<br>
<?php<br>
<br>
if ( extension_loaded('pgsql') != 1)<br>
{<br>
switch (PHP_OS)<br>
{<br>
<br>
case "WINNT": if (!extension_loaded('pgsql')) dl("php_pgsql.dll");<br>
break;<br>
default: if (!extension_loaded('pgsql')) dl("php_pgsql.so");<br>
break;<br>
}<br>
}<br>
<br>
//=========================================<br>
<br>
// includes du fichier fonctions<br>
//=========================================<br>
require 'connexion.php';<br>
<br>
<br>
function ConvertTemps ($temps) {<br>
if ($temps<60) {<br>
$temps=round($temps,0);<br>
$msg= $temps.'s';<br>
}<br>
if ($temps>=60 && $temps<3600) {<br>
$temps=round($temps,0);<br>
$temps_s=$temps % 60;<br>
$temps_mn = ($temps - $temps_s)/60;<br>
$msg= $temps_mn.'mn'.$temps_s.'s';<br>
}<br>
if ($temps>=3600) {<br>
$temps=round($temps,0);<br>
$temps_s=$temps % 3600;<br>
$temps_h=($temps - $temps_s)/3600;<br>
if ($temps_s>=60) {<br>
$temps_s=$temps % 60;<br>
$temps_mn = ($temps - $temps_s)/60;<br>
$msg= $temps_h.'h'.$temps_mn.'mn'.$temps_s.'s';<br>
} else {<br>
$msg= $temps_h.' h00mn '.$temps_s.'s';<br>
}<br>
}<br>
return $msg;<br>
}<br>
<br>
function ConvertDistance ($longueur) {<br>
$longueur=round($longueur,0);<br>
if ($longueur>=1000) {<br>
$longueur = round($longueur,0);<br>
$longueur_metre=$longueur % 1000;<br>
$longueur_km = ($longueur - $longueur_metre)/1000;<br>
$msg= $longueur_km.'km'.$longueur_metre.'m';<br>
} else {<br>
$msg= $longueur.'m';<br>
}<br>
return $msg;<br>
}<br>
<br>
<br>
function direction($x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4,$typ)<br>
{<br>
<br>
$pi=pi();<br>
$Gisement=100000;<br>
$Gisement1=100000;<br>
$dx=1000000*($x2-$x1);<br>
$dy=1000000*($y2-$y1);<br>
<br>
if (($dx==0)&&($dy==0))<br>
{<br>
$Gisement=0;<br>
}<br>
if (($dy==0)&&($dx>0))<br>
{<br>
$Gisement=100;<br>
}<br>
if (($dy==0)&&($dx<0))<br>
{<br>
$Gisement=300;<br>
}<br>
<br>
if (($Gisement!=0)&&($Gisement!=100)&&($Gisement!=300))<br>
{<br>
$di = atan(abs($dx/$dy))*200/$pi;<br>
if (($dx>=0)&&($dy<0)) {<br>
$di=200-$di;<br>
}<br>
if (($dx<=0)&&($dy<0)) {<br>
$di=200+$di;<br>
}<br>
if (($dx<=0)&&($dy>0)) {<br>
$di=400-$di;<br>
}<br>
$Gisement=$di;<br>
}<br>
<br>
$dx=1000000*($x3-$x4);<br>
$dy=1000000*($y3-$y4);<br>
<br>
if (($dx==0)&&($dy==0))<br>
{<br>
$Gisement1=0;<br>
}<br>
if (($dy==0)&&($dx>0))<br>
{<br>
$Gisement1=100;<br>
}<br>
if (($dy==0)&&($dx<0))<br>
{<br>
$Gisement1=300;<br>
}<br>
<br>
if (($Gisement1!=0)&&($Gisement1!=100)&&($Gisement1!=300))<br>
{<br>
$di = atan(abs($dx/$dy))*200/$pi;<br>
if (($dx>=0)&&($dy<0)) {<br>
$di=200-$di;<br>
}<br>
if (($dx<=0)&&($dy<0)) {<br>
$di=200+$di;<br>
}<br>
if (($dx<=0)&&($dy>0)) {<br>
$di=400-$di;<br>
}<br>
$Gisement1=$di;<br>
}<br>
<br>
$g21=$Gisement;<br>
$g23=$Gisement1;<br>
$dir=-$g23+$g21+200;<br>
if ($dir>200) {<br>
$dir = $dir-400;<br>
}<br>
if ($dir<-200) {<br>
$dir = $dir+400;<br>
}<br>
<br>
if ($dir>=-10 AND $dir<=10) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/21.gif> Continuer tout<br>
droit";<br>
}<br>
if ($dir>=-50 AND $dir<-10) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/22.gif> Serrer à droite";<br>
}<br>
if ($dir>=-110 AND $dir<-50) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/22.gif> Tourner à droite";<br>
}<br>
if ($dir>=-150 AND $dir<-100) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/22.gif>Tourner trop serrer à<br>
droite";<br>
}<br>
if ($dir>=-200 AND $dir<-150) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/22.gif>Faite demi tour à<br>
droite";<br>
}<br>
if ($dir>10 AND $dir<=50) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/24.gif>Serrer à gauche";<br>
}<br>
if ($dir>50 AND $dir<=110) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/24.gif>Tourner à gauche";<br>
}<br>
if ($dir>110 AND $dir<=150) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/24.gif>Tourner trop serrer à<br>
gauche";<br>
}<br>
if ($dir>150 AND $dir<=200) {<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/24.gif>Faite demi tour à<br>
gauche";<br>
}<br>
if($typ==1)<br>
{<br>
$msg="<IMG width=32 height=32 SRC=img/roadmap/10.gif> Prendre le Rond Point<br>
: ";<br>
}<br>
RETURN $msg;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
<br>
$counter = $pathlength = 0;<br>
<br>
// Retrieve start point<br>
$start = split(' ',$_REQUEST['startpoint']);<br>
$startPoint1 = array($start[0], $start[1]);<br>
$txtStart = $_REQUEST['txtstartpoint'];<br>
$txtEnd = $_REQUEST['txtendpoint'];<br>
//echo $_REQUEST['startpoint'];<br>
<br>
// Retrieve end point<br>
$end = split(' ',$_REQUEST['finalpoint']);<br>
$endPoint1 = array($end[0], $end[1]);<br>
//echo $_REQUEST['finalpoint'];<br>
// Find the nearest edge<br>
$startEdge = findNearestEdge($startPoint1);<br>
$endEdge = findNearestEdge($endPoint1);<br>
<br>
// FUNCTION findNearestEdge<br>
function findNearestEdge($lonlat) {<br>
<br>
// Connect to database<br>
$con = pg_connect("host=".PG_HOST."<br>
dbname=".PG_DB."<br>
user=".PG_USER."<br>
password=".PG_PASSWORD."");<br>
<br>
//$con = pg_connect("dbname=".PG_DB." host=".PG_HOST." user=".PG_USER."<br>
password=".PG_PASSWORD);<br>
$sql = "SELECT gid, source, target, the_geom,<br>
distance(the_geom, GeometryFromText(<br>
'POINT(".$lonlat[0]." ".$lonlat[1].")', -1)) AS dist<br>
FROM ".TABLE."<br>
WHERE the_geom && setsrid(<br>
'BOX3D(".($lonlat[0]-0.1)."<br>
".($lonlat[1]-0.1).",<br>
".($lonlat[0]+0.1)."<br>
".($lonlat[1]+0.1).")'::box3d, -1)<br>
ORDER BY dist LIMIT 1";<br>
//echo $sql;<br>
$query = pg_query($con,$sql);<br>
<br>
$edge['gid'] = pg_fetch_result($query, 0, 0);<br>
$edge['source'] = pg_fetch_result($query, 0, 1);<br>
$edge['target'] = pg_fetch_result($query, 0, 2);<br>
$edge['the_geom'] = pg_fetch_result($query, 0, 3);<br>
<br>
// Close database connection<br>
pg_close($con);<br>
<br>
return $edge;<br>
}<br>
<br>
// Select the routing algorithm<br>
switch($_REQUEST['method']) {<br>
<br>
case 'SPD' : // Shortest Path Dijkstra<br>
<br>
$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,<br>
length(rt.the_geom) AS length, ".TABLE.".id<br>
FROM ".TABLE.",<br>
(SELECT gid, the_geom<br>
FROM dijkstra_sp_delta(<br>
'".TABLE."',<br>
".$startEdge['source'].",<br>
".$endEdge['target'].",<br>
0.01)<br>
) as rt<br>
WHERE ".TABLE.".gid=rt.gid;";<br>
break;<br>
<br>
case 'SPA' : // Shortest Path A*<br>
<br>
$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,<br>
".TABLE.".length, ".TABLE.".id, ".TABLE.".temps,<br>
".TABLE.".on, ".TABLE.".typ, ".TABLE.".id , ".TABLE.".x1 as xs,<br>
".TABLE.".y1 as ys, ".TABLE.".x2 as xe, ".TABLE.".y2 as ye<br>
FROM ".TABLE.",<br>
(SELECT *<br>
FROM astar_sp_delta(<br>
'".TABLE."',<br>
".$startEdge['source'].",<br>
".$endEdge['target'].",<br>
0.01)<br>
) as rt<br>
WHERE ".TABLE.".gid=rt.gid;";<br>
<br>
break;<br>
<br>
case 'SPS' : // Shortest Path Shooting*<br>
if ($_REQUEST['mode']==1) {<br>
$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,<br>
length(rt.the_geom) AS length, rt.length, rt.temps,<br>
rt.on, rt.typ, ".TABLE.".id , rt.xs, rt.ys, rt.xe, <a href="http://rt.ye" target="_blank">rt.ye</a><br>
FROM ".TABLE.",<br>
(SELECT a.gid, a.the_geom, b.temps, b.on, b.typ ,<br>
b.length as length, b.x1 as xs, b.y1 as ys, b.x2 as xe, b.y2 as ye<br>
FROM shootingstar_sp(<br>
'".TABLE."',<br>
".$startEdge['gid'].",<br>
".$endEdge['gid'].",<br>
0.01, 'length',true, false) a, roads b where<br>
a.gid=b.gid<br>
) as rt<br>
WHERE ".TABLE.".gid=rt.gid;";<br>
<br>
<br>
} else {<br>
$sql = "SELECT rt.gid, AsText(rt.the_geom) AS wkt,<br>
length(rt.the_geom) AS length, rt.length, rt.temps,<br>
rt.on, rt.typ, ".TABLE.".id , rt.xs, rt.ys, rt.xe, <a href="http://rt.ye" target="_blank">rt.ye</a><br>
FROM ".TABLE.",<br>
(SELECT a.gid, a.the_geom, b.temps, b.on, b.typ ,<br>
b.length as length, b.x1 as xs, b.y1 as ys, b.x2 as xe, b.y2 as ye<br>
FROM shootingstar_sp(<br>
'".TABLE."',<br>
".$startEdge['gid'].",<br>
".$endEdge['gid'].",<br>
0.01, 'temps',true, false) a, roads b where<br>
a.gid=b.gid<br>
) as rt<br>
WHERE ".TABLE.".gid=rt.gid;";<br>
<br>
}<br>
break;<br>
<br>
} // close switch<br>
//echo $sql;<br>
// Database connection and query<br>
$dbcon = pg_connect("host=".PG_HOST."<br>
dbname=".PG_DB."<br>
user=".PG_USER."<br>
password=".PG_PASSWORD."");<br>
<br>
$query = pg_query($dbcon,$sql);<br>
<br>
// Return route as html table<br>
<br>
<br>
$xml1 .= "<style type='text/css'>";<br>
$xml1 .= "a:link {";<br>
$xml1 .= " color: #FFCC00;";<br>
$xml1 .= "}";<br>
$xml1 .= "a:visited {";<br>
$xml1 .= " color: #FFCC00;";<br>
$xml1 .= "}";<br>
$xml1 .= ".style1 {font-size: 12px;font-family: Verdana, Arial, Helvetica,<br>
sans-serif;font-weight: bold;}";<br>
$xml1 .= ".style2 {font-family: Verdana, Arial, Helvetica,<br>
sans-serif;font-size: 12px;}";<br>
$xml1 .= ".style3 {color: #808080}";<br>
$xml1 .= "</style>";<br>
echo $xml1;<br>
//echo "depart ".$startEdge['gid']." -------<p>";<br>
$xml .= "sql=".$sql." fin de la requête";<br>
$xml .= "<table width='100%' border='2' cellpadding='0' cellspacing='1'<br>
bordercolor='#FF9F00' bgcolor='#FFFFFF'>";<br>
$xml .="<tr bordercolor='#C0C0C0'>";<br>
$xml .= "<td><strong>Etape</strong></td>";<br>
$xml .= "<td><strong>Id Tronçon</strong></td>";<br>
<br>
$xml .= "<td><strong>length Etape</strong></td>";<br>
$xml .= "<td><strong>length Cumulé</strong></td>";<br>
$xml .= "<td><strong>Temps moyen</strong></td>";<br>
$xml .= "<td><strong>Nom de la Rue</strong></td>";<br>
$xml .="</tr>";<br>
<br>
// Add edges to XML file<br>
while($edge=pg_fetch_assoc($query)) {<br>
<br>
$pathlength += $edge['length'];<br>
$xml .="<tr bordercolor='#C0C0C0'>";<br>
$xml .= "<td> ".++$counter."</td>";<br>
$xml .= "<td> ".$edge['gid']."</td>";<br>
//déclaration des tableaux pour organisation de la feuille du route<br>
$ii[$counter] = $edge['gid'];<br>
$startPoint[$counter] = array($edge['xs'], $edge['ys']);<br>
$endPoint[$counter] = array($edge['xe'], $edge['ye']);<br>
$rue[$counter] = $edge['on'];<br>
$x1[$counter] = $edge['xs'];<br>
$y1[$counter] = $edge['ys'];<br>
$x2[$counter] = $edge['xe'];<br>
$y2[$counter] = $edge['ye'];<br>
$length[$counter]=$edge['length'];<br>
$temps[$counter]=3600*40/(1000*$edge['length']);<br>
$type[$counter]=$edge['typ'];<br>
<br>
//fin des déclaration<br>
<br>
$temps1=3600*40/(1000*$edge['length']);<br>
$temps_trajet +=$temps1;<br>
if ($temps1>60) {<br>
$temps1=$temps1/60;<br>
$temps2=round($temps1,0)." mn";<br>
}<br>
if ($temps1>3600) {<br>
$temps1=$temps1/3660;<br>
$temps2=round($temps1,0)." h";<br>
}<br>
if ($temps1<60) {<br>
$temps1=$temps1;<br>
$temps2=round($temps1,0)." s";<br>
}<br>
<br>
$xml .= "<td> ".round($edge['length'],2)." m</td>";<br>
$xml .= "<td> ".round(($pathlength),2)." m</td>";<br>
$xml .= "<td> ".$edge['wkt']."</td>";<br>
//pour vérifier le changement du rue par son nom<br>
$on[$i+1]=$edge['on'];<br>
$j = $i;<br>
$i +=1;<br>
if ($on[$i] != $on[$j])<br>
{<br>
$xml .= "<td> <img src='img/roadmap/2.png'>".$edge['on'].".</td>";<br>
}<br>
else {<br>
$xml .= "<td> ".$edge['on'].".</td>";<br>
}<br>
<br>
$xml .="</tr>";<br>
}<br>
$xml .= "</table>";<br>
// Close database connection<br>
pg_close($dbcon);<br>
<br>
echo "<h3 style='color:#2e585c;'>Feuille de route</h3>";<br>
<br>
// Return routing result<br>
//header('Content-type: text/xml',true);<br>
echo "<div style='width:250px; float:left; border-left:1px solid #CCCCCC;<br>
border-right:1px solid #CCCCCC; padding:0 10px;'>";<br>
<br>
echo "<span class='style3'>".htmlentities("Résumé du Trajet")."</span><br>";<br>
if ($_REQUEST['method']=='SPA')<br>
{<br>
echo "<span class='style3'>".htmlentities("Mode de Navigation :<br>
")."</span><span<br>
class='style3'>".htmlentities("Piéton")."</span></span><br>";<br>
}<br>
if ($_REQUEST['method']=='SPS')<br>
{<br>
echo "<span class='style3'>Mode de Navigation :</span><span<br>
class='style3'>Voiture</span><br>";<br>
if ($_REQUEST['mode']==1)<br>
{<br>
echo "<span class='style3'>".htmlentities("Type d'itinéraire :<br>
")."</span><span class='style3'>Le plus court</span><br>";<br>
} else {<br>
echo "<span class='style3'>".htmlentities("Type d'itinéraire :<br>
")."</span><span class='style3'>Le plus Rapide</span><br>";<br>
}<br>
}<br>
echo "<span class='style3'>Longueur du Trajet : </span><span<br>
class='style3'>";<br>
echo ConvertDistance(round(($pathlength),0))."</span><br>";<br>
echo "<span class='style3'>Temps total du Trajet : </span><span<br>
class='style3'>";<br>
echo ConvertTemps($temps_trajet)."</span></br>";<br>
echo "</div>";<br>
echo "</br>";<br>
echo "</br>";<br>
echo "</br>";<br>
echo "</br>";<br>
//echo $xml;<br>
// echo "<p>_______________________________________________<p>";<br>
// echo $counter."<p>";<br>
// echo "_______________________________________________<p>";<br>
//for($i=1; $i<=$counter ; $i++) {<br>
//echo "&&startPoint[".$i."] = array(".$x1[$i].",".$y1[$i].");<p>";<br>
//echo "&&endPoint[".$i."] = array(".$x2[$i].",".$y2[$i].");<p>";<br>
//echo "&&rue[".$i."] = |".$rue[$i]."|;<p>";<br>
//}<br>
<br>
//recherche du premier tronçon de la route<br>
for($i=1; $i<=$counter ; $i++) {<br>
if ($ii[$i]==$startEdge['gid']) {<br>
// echo "<script>alert(".$startEdge['gid'].");</script>";<br>
//stockage temporaire de la ligne n°1<br>
$tt=$rue[1];<br>
$st=$startPoint[1];<br>
$se=$endPoint[1];<br>
$ll= $length[1];<br>
$tm= $temps[1];<br>
$xxx1=$x1[1];<br>
$xxx2=$x2[1];<br>
$yyy1=$y1[1];<br>
$yyy2=$y2[1];<br>
$type_route=$type[1];<br>
//Attribution de la ligne n° 1 au premier tronçon de la route<br>
$rue[1]=$rue[$i];<br>
$startPoint[1]=$startPoint[$i];<br>
$endPoint[1]=$endPoint[$i];<br>
$length[1]=$length[$i];<br>
$temps[1]=$temps[$i];<br>
$x1[1]=$x1[$i];<br>
$x2[1]=$x2[$i];<br>
$y1[1]=$y1[$i];<br>
$y2[1]=$y2[$i];<br>
$type[1]=$type[$i];<br>
//attribution du tronçon n° i de l'ex début de route par l'exe premier<br>
enregistrement<br>
$rue[$i]=$tt;<br>
$startPoint[$i]=$st;<br>
$endPoint[$i]=$se;<br>
$length[$i]=$ll;<br>
$temps[$i]=$tm;<br>
$x1[$i]=$xxx1;<br>
$x2[$i]=$xxx2;<br>
$y1[$i]=$yyy1;<br>
$y2[$i]=$yyy2;<br>
$type[$i]=$type_route;<br>
}<br>
}<br>
<br>
$i=1;<br>
$j=1;<br>
for($i=1; $i<=$counter ; $i++)<br>
{<br>
for($j=$i+1; $j<=$counter ; $j++)<br>
{<br>
if ($startPoint[$j]==$endPoint[$i])<br>
{<br>
$T0=$startPoint[$j];<br>
$T1=$startPoint[$i+1];<br>
$T2=$endPoint[$j];<br>
$T3=$endPoint[$i+1];<br>
$T4=$rue[$j];<br>
$T5=$rue[$i+1];<br>
$T6=$length[$j];<br>
$T7=$length[$i+1];<br>
$T8=$temps[$j];<br>
$T9=$temps[$i+1];<br>
$T10=$x1[$j];<br>
$T11=$x1[$i+1];<br>
$T12=$y1[$j];<br>
$T13=$y1[$i+1];<br>
$T14=$x2[$j];<br>
$T15=$x2[$i+1];<br>
$T16=$y2[$j];<br>
$T17=$y2[$i+1];<br>
$T18=$type[$j];<br>
$T19=$type[$i+1];<br>
<br>
$startPoint[$j]=$T1;<br>
$startPoint[$i+1]=$T0;<br>
$endPoint[$j]=$T3;<br>
$endPoint[$i+1]=$T2;<br>
$rue[$j]=$T5;<br>
$rue[$i+1]=$T4;<br>
$length[$j]=$T7;<br>
$length[$i+1]=$T6;<br>
$temps[$j]=$T9;<br>
$temps[$i+1]=$T8;<br>
$x1[$j]=$T11;<br>
$x1[$i+1]=$T10;<br>
$y1[$j]=$T13;<br>
$y1[$i+1]=$T12;<br>
$x2[$j]=$T15;<br>
$x2[$i+1]=$T14;<br>
$y2[$j]=$T17;<br>
$y2[$i+1]=$T16;<br>
$type[$j]=$T19;<br>
$type[$i+1]=$T18;<br>
}<br>
}<br>
}<br>
<br>
//////////////////////////////////////////////////////////<br>
/////////////////////////////////////////////////////////////<br>
////////////////////////////////////////////////////////<br>
<br>
for($i=0; $i<=$counter ; $i++)<br>
{<br>
//assemblage des tronçons par nom des rues<br>
$comt_temp +=1;<br>
$temps_troncon += $temps[$i];<br>
$temps_cumule +=$temps[$i];<br>
$length_troncon +=$length[$i];<br>
$length_cumule +=$length[$i];<br>
if ($rue[$i+1]!=$rue[$i])<br>
{<br>
$etape +=1;<br>
if ($etape % 2 != 0) {<br>
//echo "<tr bgcolor='#B8E1F5'>";<br>
} else {<br>
//echo "<tr>";<br>
}<br>
//echo "<td><span class='style2'>".$etape."</span></td>";<br>
//echo "<td><span class='style1'>";<br>
if ($i==1) {<br>
//echo "<IMG width=32 height=32 SRC=img/drapeau/11.gif> Prendre ";<br>
} elseif ($i==$counter) {<br>
//echo "<IMG width=32 height=32 SRC=img/drapeau/12.gif> Arrivé à ";<br>
} else {<br>
//echo direction($x1[$i-1],$y1[$i-1],$x1[$i],$y1[$i],$x1[$i+1],$y1[$i+1],<br>
$x1[$i+2],$y1[$i+2], $type[$i+1]);<br>
$direction[$i]=direction($x1[$i-1],$y1[$i-1],$x1[$i],$y1[$i],$x1[$i+1],$y1[$i+1],<br>
$x1[$i+2],$y1[$i+2], $type[$i+1]);<br>
}<br>
//echo $rue[$i]."</span></td>";<br>
$NomRue[$i]=$rue[$i];<br>
//echo "<td><span class='style2'>";<br>
//echo ConvertDistance($length_troncon)."</span></td>";<br>
$DistanceTroncon[$i]=ConvertDistance($length_troncon);<br>
//echo "<td><span class='style2'>";<br>
//echo ConvertDistance($length_cumule)."</span></td>";<br>
$DistanceCumul[$i]=ConvertDistance($length_cumule);<br>
//echo "<td><span class='style2'>";<br>
//echo ConvertTemps($temps_troncon)."</span></td>";<br>
$TempsTroncon[$i]=ConvertTemps($temps_troncon);<br>
//echo "<td><span class='style2'>";<br>
//echo ConvertTemps($temps_cumule)."</span></td>";<br>
$TempsCumul[$i]=ConvertTemps($temps_cumule);<br>
//echo "</tr>";<br>
//initialiser le compteur<br>
$comt_temp =0;<br>
$temps_troncon=0;<br>
$length_troncon=0;<br>
}<br>
}<br>
//echo "</table>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0 10px;<br>
margin-bottom:5px;'><div style='float:left; width:275px;'><img<br>
src='img/drapeau/14.png'>".htmlentities("Départ")." :<br>
".$txtStart."</div></div><br>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0<br>
10px; margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".$direction[0]."</div>";<br>
echo $DistanceTroncon[1]."</div>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0<br>
10px; margin-bottom:5px;'><div style='float:left; width:275px;'> de<br>
</div></div>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0<br>
10px; margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".$NomRue[1]."</div></div>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0<br>
10px; margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".htmlentities(" ")."</div></div>";<br>
echo "<p>";<br>
for($i=1; $i<=$counter-2 ; $i++)<br>
{<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0 10px;<br>
margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".$direction[$i]."</div></div>";<br>
echo " ";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0 10px;<br>
margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".$NomRue[$i+1]."</div>";<br>
echo $DistanceTroncon[$i]."</div>";<br>
//echo "coucou";<br>
//echo "<p>";<br>
}<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0 10px;<br>
margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".$direction[$counter-1]."</div></div>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0<br>
10px; margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".$direction[$i]."</div></div>";htmlentities(" et vous arrivez<br>
à ")."</div></div>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0<br>
10px; margin-bottom:5px;'><div style='float:left;<br>
width:275px;'>".$NomRue[$counter]."</div>";<br>
echo $DistanceTroncon[$counter-1]."</div></div>";<br>
echo "<div style='background-color:#f0f0f0; color:#00519e; padding:0<br>
10px; margin-bottom:5px;'><div style='float:left; width:275px;'><img<br>
src='img/drapeau/15.png'>".htmlentities("Arrivé")." :<br>
".$txtEnd."</div></div><br>";<br>
?><br>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <a href="http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20110201/58011936/attachment.html" target="_blank">http://lists.osgeo.org/pipermail/pgrouting-users/attachments/20110201/58011936/attachment.html</a><br>
<br>
------------------------------<br>
<br>
_______________________________________________<br>
Pgrouting-users mailing list<br>
<a href="mailto:Pgrouting-users@lists.osgeo.org">Pgrouting-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/pgrouting-users</a><br>
<br>
<br>
End of Pgrouting-users Digest, Vol 29, Issue 2<br>
**********************************************<br>
</blockquote></div><br><br clear="all"><br>-- <br>Cléber D. Arruda<br>Kämnärsvägen 33C<br>226 46<br>Lund - Sweden<br>Phone +46737762526<br>E-mail: <a href="mailto:cleverdo@gmail.com" target="_blank">cleverdo@gmail.com</a><br>
<br>Peace and Love Always.<br><br>