<div dir="ltr"><div>hi,</div><div>i hope this code can help you. it s not complete and not optimised</div><div>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////</div>
<div>&lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>&quot;&gt;</div><div><br></div><div>&lt;?php</div><div><br></div><div>if ( extension_loaded(&#39;pgsql&#39;) != 1)</div><div>
{</div><div>    switch (PHP_OS)</div><div>    {</div><div><br></div><div>  case &quot;WINNT&quot;: if (!extension_loaded(&#39;pgsql&#39;))  dl(&quot;php_pgsql.dll&quot;);</div><div>                    break;</div><div>      default:  if (!extension_loaded(&#39;pgsql&#39;))  dl(&quot;php_pgsql.so&quot;);</div>
<div>               break;</div><div>  }</div><div>}</div><div><br></div><div>//=========================================</div><div><br></div><div>// includes du fichier fonctions</div><div>//=========================================</div>
<div>require &#39;connexion.php&#39;;</div><div><br></div><div><br></div><div>function ConvertTemps ($temps) {</div><div>if ($temps&lt;60) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps=round($temps,0);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>$msg= $temps.&#39;s&#39;;</div><div>}</div><div>if ($temps&gt;=60 &amp;&amp; $temps&lt;3600) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps=round($temps,0);</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps_s=$temps % 60;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps_mn = ($temps - $temps_s)/60;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$msg= $temps_mn.&#39;mn&#39;.$temps_s.&#39;s&#39;;</div>
<div>}</div><div>if ($temps&gt;=3600) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps=round($temps,0);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps_s=$temps % 3600;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps_h=($temps - $temps_s)/3600;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ($temps_s&gt;=60) {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$temps_s=$temps % 60;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>$temps_mn = ($temps - $temps_s)/60;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$msg= $temps_h.&#39;h&#39;.$temps_mn.&#39;mn&#39;.$temps_s.&#39;s&#39;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg= $temps_h.&#39; h00mn &#39;.$temps_s.&#39;s&#39;;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div>
<div>}</div><div>return $msg;</div><div>}</div><div><br></div><div>function ConvertDistance ($longueur) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$longueur=round($longueur,0);</div><div>if ($longueur&gt;=1000) {</div>
<div>$longueur = round($longueur,0);</div><div>$longueur_metre=$longueur % 1000;</div><div>$longueur_km = ($longueur - $longueur_metre)/1000;</div><div>$msg= $longueur_km.&#39;km&#39;.$longueur_metre.&#39;m&#39;;</div><div>
} else {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$msg= $longueur.&#39;m&#39;;</div><div>}</div><div>return $msg;</div><div>}</div><div><br></div><div><br></div><div>function direction($x1,$y1,$x2,$y2,$x3,$y3,$x4,$y4,$typ)</div>
<div>{</div><div><br></div><div>$pi=pi();</div><div>$Gisement=100000;</div><div>$Gisement1=100000;</div><div>$dx=1000000*($x2-$x1);</div><div>$dy=1000000*($y2-$y1);</div><div><br></div><div>if (($dx==0)&amp;&amp;($dy==0)) </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$Gisement=0;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>if (($dy==0)&amp;&amp;($dx&gt;0)) </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$Gisement=100;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>if (($dy==0)&amp;&amp;($dx&lt;0)) </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>$Gisement=300;<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br></div><div>if (($Gisement!=0)&amp;&amp;($Gisement!=100)&amp;&amp;($Gisement!=300))</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$di = atan(abs($dx/$dy))*200/$pi;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>if (($dx&gt;=0)&amp;&amp;($dy&lt;0)) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$di=200-$di;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (($dx&lt;=0)&amp;&amp;($dy&lt;0)) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$di=200+$di;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (($dx&lt;=0)&amp;&amp;($dy&gt;0)) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$di=400-$di;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>$Gisement=$di;<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>
<br></div><div>$dx=1000000*($x3-$x4);</div><div>$dy=1000000*($y3-$y4);</div><div><br></div><div>if (($dx==0)&amp;&amp;($dy==0)) </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$Gisement1=0;<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>if (($dy==0)&amp;&amp;($dx&gt;0)) </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>$Gisement1=100;<span class="Apple-tab-span" style="white-space:pre">        </span></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>if (($dy==0)&amp;&amp;($dx&lt;0)) </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$Gisement1=300;<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div>if (($Gisement1!=0)&amp;&amp;($Gisement1!=100)&amp;&amp;($Gisement1!=300))</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>$di = atan(abs($dx/$dy))*200/$pi;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (($dx&gt;=0)&amp;&amp;($dy&lt;0)) {</div><div>
<span class="Apple-tab-span" style="white-space:pre">                        </span>$di=200-$di;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (($dx&lt;=0)&amp;&amp;($dy&lt;0)) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$di=200+$di;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if (($dx&lt;=0)&amp;&amp;($dy&gt;0)) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$di=400-$di;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$Gisement1=$di;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><br></div><div>$g21=$Gisement;</div><div>$g23=$Gisement1;</div><div>$dir=-$g23+$g21+200;</div><div>if ($dir&gt;200) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$dir = $dir-400;</div>
<div>}</div><div>if ($dir&lt;-200) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$dir = $dir+400;</div><div>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;=-10 AND $dir&lt;=10) { </div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/21.gif&gt; Continuer tout droit&quot;; </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;=-50 AND $dir&lt;-10) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/22.gif&gt; Serrer à droite&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;=-110 AND $dir&lt;-50) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/22.gif&gt; Tourner à droite&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;=-150 AND $dir&lt;-100) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/22.gif&gt;Tourner trop serrer à droite&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;=-200 AND $dir&lt;-150) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/22.gif&gt;Faite demi tour à droite&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;10 AND $dir&lt;=50) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/24.gif&gt;Serrer à gauche&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;50 AND $dir&lt;=110) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/24.gif&gt;Tourner à gauche&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;110 AND $dir&lt;=150) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/24.gif&gt;Tourner trop serrer à gauche&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($dir&gt;150 AND $dir&lt;=200) { </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/24.gif&gt;Faite demi tour à gauche&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>if($typ==1)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div>$msg=&quot;&lt;IMG width=32 height=32 SRC=img/roadmap/10.gif&gt; Prendre le Rond Point : &quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>RETURN $msg;</div><div>}</div><div><br></div><div><br></div><div><br></div>
<div>  </div><div><br></div><div>  </div><div>  $counter = $pathlength = 0;</div><div><br></div><div>  // Retrieve start point</div><div>  $start = split(&#39; &#39;,$_REQUEST[&#39;startpoint&#39;]);</div><div>  $startPoint1 = array($start[0], $start[1]);</div>
<div>$txtStart = $_REQUEST[&#39;txtstartpoint&#39;];</div><div>$txtEnd = $_REQUEST[&#39;txtendpoint&#39;];</div><div>  //echo $_REQUEST[&#39;startpoint&#39;];</div><div>  </div><div>  // Retrieve end point</div><div>  $end = split(&#39; &#39;,$_REQUEST[&#39;finalpoint&#39;]);</div>
<div>  $endPoint1 = array($end[0], $end[1]);</div><div>//echo $_REQUEST[&#39;finalpoint&#39;];</div><div>  // Find the nearest edge</div><div>  $startEdge = findNearestEdge($startPoint1);</div><div>  $endEdge   = findNearestEdge($endPoint1);</div>
<div><br></div><div>  // FUNCTION findNearestEdge</div><div>  function findNearestEdge($lonlat) {</div><div>    </div><div>    // Connect to database</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  $con  = pg_connect(&quot;host=&quot;.PG_HOST.&quot; </div>
<div>                        dbname=&quot;.PG_DB.&quot; </div><div>                        user=&quot;.PG_USER.&quot; </div><div>                        password=&quot;.PG_PASSWORD.&quot;&quot;); </div><div>                </div>
<div>    //$con = pg_connect(&quot;dbname=&quot;.PG_DB.&quot; host=&quot;.PG_HOST.&quot; user=&quot;.PG_USER.&quot; password=&quot;.PG_PASSWORD);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div>    $sql = &quot;SELECT gid, source, target, the_geom, </div><div><span class="Apple-tab-span" style="white-space:pre">                        </span> distance(the_geom, GeometryFromText(</div><div>                  &#39;POINT(&quot;.$lonlat[0].&quot; &quot;.$lonlat[1].&quot;)&#39;, -1)) AS dist </div>
<div>            FROM &quot;.TABLE.&quot;  </div><div>            WHERE the_geom &amp;&amp; setsrid(</div><div>                  &#39;BOX3D(&quot;.($lonlat[0]-0.1).&quot; </div><div>                         &quot;.($lonlat[1]-0.1).&quot;, </div>
<div>                         &quot;.($lonlat[0]+0.1).&quot; </div><div>                         &quot;.($lonlat[1]+0.1).&quot;)&#39;::box3d, -1) </div><div>            ORDER BY dist LIMIT 1&quot;;</div><div>  //echo $sql; </div>
<div>    $query = pg_query($con,$sql);  </div><div> </div><div>    $edge[&#39;gid&#39;]      = pg_fetch_result($query, 0, 0);  </div><div>    $edge[&#39;source&#39;]   = pg_fetch_result($query, 0, 1);  </div><div>    $edge[&#39;target&#39;]   = pg_fetch_result($query, 0, 2);  </div>
<div>    $edge[&#39;the_geom&#39;] = pg_fetch_result($query, 0, 3);  </div><div><br></div><div>    // Close database connection</div><div>    pg_close($con);</div><div><br></div><div>    return $edge;</div><div>  }</div><div>
<br></div><div>  // Select the routing algorithm</div><div>  switch($_REQUEST[&#39;method&#39;]) {</div><div><br></div><div>    case &#39;SPD&#39; : // Shortest Path Dijkstra </div><div><br></div><div>      $sql = &quot;SELECT rt.gid, AsText(rt.the_geom) AS wkt, </div>
<div>                   length(rt.the_geom) AS length, &quot;.TABLE.&quot;.id </div><div>                FROM &quot;.TABLE.&quot;, </div><div>                    (SELECT gid, the_geom </div><div>                        FROM dijkstra_sp_delta(</div>
<div>                            &#39;&quot;.TABLE.&quot;&#39;,</div><div>                            &quot;.$startEdge[&#39;source&#39;].&quot;,</div><div>                            &quot;.$endEdge[&#39;target&#39;].&quot;,</div>
<div>                            0.01)</div><div>                     ) as rt </div><div>                WHERE &quot;.TABLE.&quot;.gid=rt.gid;&quot;;</div><div>      break;</div><div><br></div><div>    case &#39;SPA&#39; : // Shortest Path A* </div>
<div><br></div><div>       $sql = &quot;SELECT rt.gid, AsText(rt.the_geom) AS wkt, </div><div>                     &quot;.TABLE.&quot;.length, &quot;.TABLE.&quot;.id, &quot;.TABLE.&quot;.temps, &quot;.TABLE.&quot;.on, &quot;.TABLE.&quot;.typ, &quot;.TABLE.&quot;.id ,  &quot;.TABLE.&quot;.x1 as xs,  &quot;.TABLE.&quot;.y1 as ys,  &quot;.TABLE.&quot;.x2 as xe,  &quot;.TABLE.&quot;.y2 as ye </div>
<div>                  FROM &quot;.TABLE.&quot;, </div><div>                      (SELECT * </div><div>                          FROM astar_sp_delta(</div><div>                              &#39;&quot;.TABLE.&quot;&#39;,</div>
<div>                              &quot;.$startEdge[&#39;source&#39;].&quot;,</div><div>                              &quot;.$endEdge[&#39;target&#39;].&quot;,</div><div>                              0.01)</div><div>                       ) as rt </div>
<div>                  WHERE &quot;.TABLE.&quot;.gid=rt.gid;&quot;;  </div><div><br></div><div>      break;</div><div><br></div><div>    case &#39;SPS&#39; : // Shortest Path Shooting*</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ($_REQUEST[&#39;mode&#39;]==1) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>$sql = &quot;SELECT rt.gid, AsText(rt.the_geom) AS wkt, </div><div>                     length(rt.the_geom) AS length, rt.length, rt.temps, rt.on, rt.typ, &quot;.TABLE.&quot;.id , rt.xs, rt.ys, rt.xe, <a href="http://rt.ye">rt.ye</a></div>
<div>                  FROM &quot;.TABLE.&quot;, </div><div>                      (SELECT a.gid, a.the_geom, b.temps, b.on, b.typ , b.length as length, b.x1 as xs, b.y1 as ys, b.x2 as xe, b.y2 as ye</div><div>                          FROM shootingstar_sp(</div>
<div>                              &#39;&quot;.TABLE.&quot;&#39;,</div><div>                              &quot;.$startEdge[&#39;gid&#39;].&quot;,</div><div>                              &quot;.$endEdge[&#39;gid&#39;].&quot;,</div>
<div>                              0.01, &#39;length&#39;,true, false) a, roads b where a.gid=b.gid</div><div>                       ) as rt </div><div>                  WHERE &quot;.TABLE.&quot;.gid=rt.gid;&quot;; </div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>  </div><div>       </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  } else {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$sql = &quot;SELECT rt.gid, AsText(rt.the_geom) AS wkt, </div>
<div>                     length(rt.the_geom) AS length, rt.length, rt.temps, rt.on, rt.typ, &quot;.TABLE.&quot;.id , rt.xs, rt.ys, rt.xe, <a href="http://rt.ye">rt.ye</a></div><div>                  FROM &quot;.TABLE.&quot;, </div>
<div>                      (SELECT a.gid, a.the_geom, b.temps, b.on, b.typ , b.length as length, b.x1 as xs, b.y1 as ys, b.x2 as xe, b.y2 as ye</div><div>                          FROM shootingstar_sp(</div><div>                              &#39;&quot;.TABLE.&quot;&#39;,</div>
<div>                              &quot;.$startEdge[&#39;gid&#39;].&quot;,</div><div>                              &quot;.$endEdge[&#39;gid&#39;].&quot;,</div><div>                              0.01, &#39;temps&#39;,true, false) a, roads b where a.gid=b.gid</div>
<div>                       ) as rt </div><div>                  WHERE &quot;.TABLE.&quot;.gid=rt.gid;&quot;;  </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  }</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>  break;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  </div><div>  } // close switch</div><div>//echo $sql;</div><div>  // Database connection and query</div>
<div>  $dbcon = pg_connect(&quot;host=&quot;.PG_HOST.&quot; </div><div>                        dbname=&quot;.PG_DB.&quot; </div><div>                        user=&quot;.PG_USER.&quot; </div><div>                        password=&quot;.PG_PASSWORD.&quot;&quot;); </div>
<div>    </div><div>  $query = pg_query($dbcon,$sql); </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  </div><div>  // Return route as html table</div><div><br></div><div><br></div><div>$xml1  .= &quot;&lt;style type=&#39;text/css&#39;&gt;&quot;;</div>
<div>$xml1  .= &quot;a:link {&quot;;</div><div>$xml1  .= &quot;<span class="Apple-tab-span" style="white-space:pre">        </span>color: #FFCC00;&quot;;</div><div>$xml1  .= &quot;}&quot;;</div><div>$xml1  .= &quot;a:visited {&quot;;</div>
<div>$xml1  .= &quot;<span class="Apple-tab-span" style="white-space:pre">        </span>color: #FFCC00;&quot;;</div><div>$xml1  .= &quot;}&quot;;</div><div>$xml1  .= &quot;.style1 {font-size: 12px;font-family: Verdana, Arial, Helvetica, sans-serif;font-weight: bold;}&quot;;</div>
<div>$xml1  .= &quot;.style2 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 12px;}&quot;; </div><div>$xml1  .= &quot;.style3 {color: #808080}&quot;;</div><div>$xml1  .= &quot;&lt;/style&gt;&quot;;</div><div>
echo $xml1;</div><div>//echo &quot;depart &quot;.$startEdge[&#39;gid&#39;].&quot; -------&lt;p&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$xml .= &quot;sql=&quot;.$sql.&quot; fin de la requête&quot;; </div>
<div>  $xml .= &quot;&lt;table width=&#39;100%&#39; border=&#39;2&#39; cellpadding=&#39;0&#39; cellspacing=&#39;1&#39; bordercolor=&#39;#FF9F00&#39; bgcolor=&#39;#FFFFFF&#39;&gt;&quot;;</div><div>  $xml .=&quot;&lt;tr bordercolor=&#39;#C0C0C0&#39;&gt;&quot;;</div>
<div>  $xml .= &quot;&lt;td&gt;&lt;strong&gt;Etape&lt;/strong&gt;&lt;/td&gt;&quot;;</div><div>  $xml .= &quot;&lt;td&gt;&lt;strong&gt;Id Tronçon&lt;/strong&gt;&lt;/td&gt;&quot;;</div><div>  </div><div>  $xml .= &quot;&lt;td&gt;&lt;strong&gt;length Etape&lt;/strong&gt;&lt;/td&gt;&quot;;</div>
<div>  $xml .= &quot;&lt;td&gt;&lt;strong&gt;length Cumulé&lt;/strong&gt;&lt;/td&gt;&quot;;</div><div>  $xml .= &quot;&lt;td&gt;&lt;strong&gt;Temps moyen&lt;/strong&gt;&lt;/td&gt;&quot;;</div><div>  $xml .= &quot;&lt;td&gt;&lt;strong&gt;Nom de la Rue&lt;/strong&gt;&lt;/td&gt;&quot;;</div>
<div>  $xml .=&quot;&lt;/tr&gt;&quot;; </div><div>  </div><div>  // Add edges to XML file</div><div>  while($edge=pg_fetch_assoc($query)) {  </div><div><br></div><div>    $pathlength += $edge[&#39;length&#39;];</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>$xml .=&quot;&lt;tr bordercolor=&#39;#C0C0C0&#39;&gt;&quot;;</div><div>    $xml .= &quot;&lt;td&gt; &quot;.++$counter.&quot;&lt;/td&gt;&quot;;</div><div>    $xml .= &quot;&lt;td&gt; &quot;.$edge[&#39;gid&#39;].&quot;&lt;/td&gt;&quot;;</div>
<div>//déclaration des tableaux pour organisation de la feuille du route<span class="Apple-tab-span" style="white-space:pre">        </span></div><div>$ii[$counter] = $edge[&#39;gid&#39;];<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div>$startPoint[$counter] = array($edge[&#39;xs&#39;], $edge[&#39;ys&#39;]);</div><div>$endPoint[$counter] = array($edge[&#39;xe&#39;], $edge[&#39;ye&#39;]);</div><div>$rue[$counter] = $edge[&#39;on&#39;];</div><div>$x1[$counter] = $edge[&#39;xs&#39;];</div>
<div>$y1[$counter] = $edge[&#39;ys&#39;];</div><div>$x2[$counter] = $edge[&#39;xe&#39;];</div><div>$y2[$counter] = $edge[&#39;ye&#39;];</div><div>$length[$counter]=$edge[&#39;length&#39;];</div><div>$temps[$counter]=3600*40/(1000*$edge[&#39;length&#39;]);</div>
<div>$type[$counter]=$edge[&#39;typ&#39;];</div><div><br></div><div>//fin des déclaration</div><div><br></div><div>$temps1=3600*40/(1000*$edge[&#39;length&#39;]);</div><div>$temps_trajet +=$temps1;</div><div>if ($temps1&gt;60) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps1=$temps1/60;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps2=round($temps1,0).&quot; mn&quot;;</div><div>}</div><div>
if ($temps1&gt;3600) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps1=$temps1/3660;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps2=round($temps1,0).&quot; h&quot;;</div>
<div>}</div><div>if ($temps1&lt;60) {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps1=$temps1;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$temps2=round($temps1,0).&quot; s&quot;;</div>
<div>}</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$xml .= &quot;&lt;td&gt; &quot;.round($edge[&#39;length&#39;],2).&quot; m&lt;/td&gt;&quot;;</div><div>    $xml .= &quot;&lt;td&gt; &quot;.round(($pathlength),2).&quot; m&lt;/td&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>$xml .= &quot;&lt;td&gt; &quot;.$edge[&#39;wkt&#39;].&quot;&lt;/td&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div>//pour vérifier le changement du rue par son nom    </div><div>$on[$i+1]=$edge[&#39;on&#39;];</div><div>$j = $i;</div><div>$i +=1;</div><div>if ($on[$i] != $on[$j]) </div><div>{</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>$xml .= &quot;&lt;td&gt; &lt;img src=&#39;img/roadmap/2.png&#39;&gt;&quot;.$edge[&#39;on&#39;].&quot;.&lt;/td&gt;&quot;;</div>
<div>}</div><div>else {</div><div>$xml .= &quot;&lt;td&gt; &quot;.$edge[&#39;on&#39;].&quot;.&lt;/td&gt;&quot;;<span class="Apple-tab-span" style="white-space:pre">        </span></div><div>}</div><div><br></div><div>$xml .=&quot;&lt;/tr&gt;&quot;; </div>
<div>  }</div><div>  $xml .= &quot;&lt;/table&gt;&quot;;     </div><div>  // Close database connection</div><div>  pg_close($dbcon);</div><div><br></div><div>echo &quot;&lt;h3 style=&#39;color:#2e585c;&#39;&gt;Feuille de route&lt;/h3&gt;&quot;;</div>
<div><br></div><div>  // Return routing result</div><div>  //header(&#39;Content-type: text/xml&#39;,true);</div><div>echo &quot;&lt;div style=&#39;width:250px; float:left; border-left:1px solid #CCCCCC;  border-right:1px solid #CCCCCC; padding:0 10px;&#39;&gt;&quot;;</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;span class=&#39;style3&#39;&gt;&quot;.htmlentities(&quot;Résumé du Trajet&quot;).&quot;&lt;/span&gt;&lt;br&gt;&quot;;</div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>if ($_REQUEST[&#39;method&#39;]==&#39;SPA&#39;)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>echo &quot;&lt;span class=&#39;style3&#39;&gt;&quot;.htmlentities(&quot;Mode de Navigation : &quot;).&quot;&lt;/span&gt;&lt;span class=&#39;style3&#39;&gt;&quot;.htmlentities(&quot;Piéton&quot;).&quot;&lt;/span&gt;&lt;/span&gt;&lt;br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if ($_REQUEST[&#39;method&#39;]==&#39;SPS&#39;)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>echo &quot;&lt;span class=&#39;style3&#39;&gt;Mode de Navigation :&lt;/span&gt;&lt;span class=&#39;style3&#39;&gt;Voiture&lt;/span&gt;&lt;br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>if ($_REQUEST[&#39;mode&#39;]==1)</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>{</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>echo &quot;&lt;span class=&#39;style3&#39;&gt;&quot;.htmlentities(&quot;Type d&#39;itinéraire : &quot;).&quot;&lt;/span&gt;&lt;span class=&#39;style3&#39;&gt;Le plus court&lt;/span&gt;&lt;br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>echo &quot;&lt;span class=&#39;style3&#39;&gt;&quot;.htmlentities(&quot;Type d&#39;itinéraire : &quot;).&quot;&lt;/span&gt;&lt;span class=&#39;style3&#39;&gt;Le plus Rapide&lt;/span&gt;&lt;br&gt;&quot;;<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span></div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;span class=&#39;style3&#39;&gt;Longueur du Trajet : &lt;/span&gt;&lt;span class=&#39;style3&#39;&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>echo ConvertDistance(round(($pathlength),0)).&quot;&lt;/span&gt;&lt;br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;span class=&#39;style3&#39;&gt;Temps total du Trajet : &lt;/span&gt;&lt;span class=&#39;style3&#39;&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>echo ConvertTemps($temps_trajet).&quot;&lt;/span&gt;&lt;/br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;/div&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;/br&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;/br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;/br&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;/br&gt;&quot;;</div><div>  //echo $xml;</div>
<div>// <span class="Apple-tab-span" style="white-space:pre">        </span> echo &quot;&lt;p&gt;_______________________________________________&lt;p&gt;&quot;;</div><div>//  echo $counter.&quot;&lt;p&gt;&quot;;</div><div>//   echo &quot;_______________________________________________&lt;p&gt;&quot;;</div>
<div>//for($i=1; $i&lt;=$counter ; $i++) {</div><div>//echo &quot;&amp;&amp;startPoint[&quot;.$i.&quot;] = array(&quot;.$x1[$i].&quot;,&quot;.$y1[$i].&quot;);&lt;p&gt;&quot;;</div><div>//echo &quot;&amp;&amp;endPoint[&quot;.$i.&quot;] = array(&quot;.$x2[$i].&quot;,&quot;.$y2[$i].&quot;);&lt;p&gt;&quot;;</div>
<div>//echo &quot;&amp;&amp;rue[&quot;.$i.&quot;] = |&quot;.$rue[$i].&quot;|;&lt;p&gt;&quot;;</div><div>//}</div><div>   </div><div>  //recherche du premier tronçon de la route</div><div>for($i=1; $i&lt;=$counter ; $i++) {</div>
<div>  if ($ii[$i]==$startEdge[&#39;gid&#39;]) {</div><div>//<span class="Apple-tab-span" style="white-space:pre">        </span>echo &quot;&lt;script&gt;alert(&quot;.$startEdge[&#39;gid&#39;].&quot;);&lt;/script&gt;&quot;;   </div>
<div>  //stockage temporaire de la ligne n°1</div><div>  $tt=$rue[1];</div><div>  $st=$startPoint[1];</div><div>  $se=$endPoint[1];</div><div>  $ll= $length[1];</div><div>  $tm= $temps[1];</div><div>  $xxx1=$x1[1];</div><div>
  $xxx2=$x2[1];</div><div>  $yyy1=$y1[1];</div><div>  $yyy2=$y2[1];</div><div>  $type_route=$type[1];</div><div>  //Attribution de la ligne n° 1 au premier tronçon de la route</div><div>  $rue[1]=$rue[$i];</div><div>  $startPoint[1]=$startPoint[$i];</div>
<div>  $endPoint[1]=$endPoint[$i];</div><div>  $length[1]=$length[$i];</div><div>  $temps[1]=$temps[$i];</div><div>  $x1[1]=$x1[$i];</div><div>  $x2[1]=$x2[$i];</div><div>  $y1[1]=$y1[$i];</div><div>  $y2[1]=$y2[$i];</div>
<div>  $type[1]=$type[$i];</div><div>  //attribution du tronçon n° i de l&#39;ex début de route par l&#39;exe premier enregistrement</div><div>  $rue[$i]=$tt;</div><div>  $startPoint[$i]=$st;</div><div>  $endPoint[$i]=$se;</div>
<div>  $length[$i]=$ll;</div><div>  $temps[$i]=$tm;</div><div>  $x1[$i]=$xxx1;</div><div>  $x2[$i]=$xxx2;</div><div>  $y1[$i]=$yyy1;</div><div>  $y2[$i]=$yyy2;</div><div>  $type[$i]=$type_route;</div><div>  } </div><div> }</div>
<div>  </div><div> $i=1;</div><div> $j=1;</div><div> for($i=1; $i&lt;=$counter ; $i++) </div><div>  {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  for($j=$i+1; $j&lt;=$counter ; $j++) </div><div>
<span class="Apple-tab-span" style="white-space:pre">        </span>  {  </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  if ($startPoint[$j]==$endPoint[$i]) </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T0=$startPoint[$j];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T1=$startPoint[$i+1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T2=$endPoint[$j];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T3=$endPoint[$i+1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T4=$rue[$j];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T5=$rue[$i+1];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T6=$length[$j];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T7=$length[$i+1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T8=$temps[$j];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T9=$temps[$i+1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T10=$x1[$j];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T11=$x1[$i+1];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T12=$y1[$j];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T13=$y1[$i+1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T14=$x2[$j];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T15=$x2[$i+1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T16=$y2[$j];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T17=$y2[$i+1];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T18=$type[$j];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$T19=$type[$i+1];</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$startPoint[$j]=$T1;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$startPoint[$i+1]=$T0;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$endPoint[$j]=$T3;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$endPoint[$i+1]=$T2;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$rue[$j]=$T5;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$rue[$i+1]=$T4;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$length[$j]=$T7;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$length[$i+1]=$T6;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$temps[$j]=$T9;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$temps[$i+1]=$T8;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$x1[$j]=$T11;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$x1[$i+1]=$T10;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$y1[$j]=$T13;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$y1[$i+1]=$T12;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$x2[$j]=$T15;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$x2[$i+1]=$T14;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$y2[$j]=$T17;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$y2[$i+1]=$T16;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>$type[$j]=$T19;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>$type[$i+1]=$T18;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>  }</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  }</div><div>  }</div><div><br></div><div>//////////////////////////////////////////////////////////</div>
<div>  /////////////////////////////////////////////////////////////</div><div>  ////////////////////////////////////////////////////////</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>  for($i=0; $i&lt;=$counter ; $i++) </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>    {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  //assemblage des tronçons par nom des rues</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>$comt_temp +=1;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>$temps_troncon += $temps[$i];</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>$temps_cumule +=$temps[$i];</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>$length_troncon +=$length[$i];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>$length_cumule +=$length[$i];</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  if ($rue[$i+1]!=$rue[$i]) </div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>$etape +=1;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>if ($etape % 2 != 0) {<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;tr bgcolor=&#39;#B8E1F5&#39;&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;tr&gt;&quot;;<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;td&gt;&lt;span class=&#39;style2&#39;&gt;&quot;.$etape.&quot;&lt;/span&gt;&lt;/td&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;td&gt;&lt;span class=&#39;style1&#39;&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>if ($i==1) {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>//echo &quot;&lt;IMG width=32 height=32 SRC=img/drapeau/11.gif&gt; Prendre &quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>} elseif ($i==$counter) {</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>//echo &quot;&lt;IMG width=32 height=32 SRC=img/drapeau/12.gif&gt; Arrivé à &quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                        </span>} else {</div><div><span class="Apple-tab-span" style="white-space:pre">                                                                                                </span></div><div><span class="Apple-tab-span" style="white-space:pre">                                                </span>//echo direction($x1[$i-1],$y1[$i-1],$x1[$i],$y1[$i],$x1[$i+1],$y1[$i+1], $x1[$i+2],$y1[$i+2], $type[$i+1]);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                                </span>$direction[$i]=direction($x1[$i-1],$y1[$i-1],$x1[$i],$y1[$i],$x1[$i+1],$y1[$i+1], $x1[$i+2],$y1[$i+2], $type[$i+1]);</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>}</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo $rue[$i].&quot;&lt;/span&gt;&lt;/td&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$NomRue[$i]=$rue[$i];</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;td&gt;&lt;span class=&#39;style2&#39;&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo ConvertDistance($length_troncon).&quot;&lt;/span&gt;&lt;/td&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>$DistanceTroncon[$i]=ConvertDistance($length_troncon);</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;td&gt;&lt;span class=&#39;style2&#39;&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo ConvertDistance($length_cumule).&quot;&lt;/span&gt;&lt;/td&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$DistanceCumul[$i]=ConvertDistance($length_cumule);<span class="Apple-tab-span" style="white-space:pre">                </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;td&gt;&lt;span class=&#39;style2&#39;&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo ConvertTemps($temps_troncon).&quot;&lt;/span&gt;&lt;/td&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>$TempsTroncon[$i]=ConvertTemps($temps_troncon);</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;td&gt;&lt;span class=&#39;style2&#39;&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo ConvertTemps($temps_cumule).&quot;&lt;/span&gt;&lt;/td&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$TempsCumul[$i]=ConvertTemps($temps_cumule);</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>//echo &quot;&lt;/tr&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>//initialiser le compteur</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>$comt_temp =0;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                                </span>$temps_troncon=0;</div><div><span class="Apple-tab-span" style="white-space:pre">                                </span>$length_troncon=0;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>  }</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   }</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>   //echo &quot;&lt;/table&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div>
<div>echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&lt;img src=&#39;img/drapeau/14.png&#39;&gt;&quot;.htmlentities(&quot;Départ&quot;).&quot; : &quot;.$txtStart.&quot;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.$direction[0].&quot;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo $DistanceTroncon[1].&quot;&lt;/div&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt; de &lt;/div&gt;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.$NomRue[1].&quot;&lt;/div&gt;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.htmlentities(&quot;  &quot;).&quot;&lt;/div&gt;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;p&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>   for($i=1; $i&lt;=$counter-2 ; $i++) </div><div><span class="Apple-tab-span" style="white-space:pre">        </span>    {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.$direction[$i].&quot;&lt;/div&gt;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>echo &quot;  &quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.$NomRue[$i+1].&quot;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>echo $DistanceTroncon[$i].&quot;&lt;/div&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>//echo &quot;coucou&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                        </span>//echo &quot;&lt;p&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><span class="Apple-tab-span" style="white-space:pre">                </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.$direction[$counter-1].&quot;&lt;/div&gt;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.$direction[$i].&quot;&lt;/div&gt;&lt;/div&gt;&quot;;htmlentities(&quot; et vous arrivez à &quot;).&quot;&lt;/div&gt;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&quot;.$NomRue[$counter].&quot;&lt;/div&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo $DistanceTroncon[$counter-1].&quot;&lt;/div&gt;&lt;/div&gt;&quot;;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>   echo &quot;&lt;div style=&#39;background-color:#f0f0f0; color:#00519e; padding:0 10px; margin-bottom:5px;&#39;&gt;&lt;div style=&#39;float:left; width:275px;&#39;&gt;&lt;img src=&#39;img/drapeau/15.png&#39;&gt;&quot;.htmlentities(&quot;Arrivé&quot;).&quot; : &quot;.$txtEnd.&quot;&lt;/div&gt;&lt;/div&gt;&lt;br&gt;&quot;;</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span></div><div>?&gt;</div><div>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////</div>

</div>