C O N O S C E N Z A
web data management
Il nostro è un team che si occupa ormai da piu' di un decennio della risoluzione delle problematiche informatiche, in particolare ci piace poter offrire la nostra competenza in ambito telematico, dalla progettazione su misura della vostra infrastruttura web, alla realizzazione del vostro software e dei vostri portali.
Web

Cardinal points management using virtual earth mappoint api

15/11/2008

Example of cardinal points management  using virtual earth mappoint api  by  php

 

 It's included a  db with points used in the loop writed above and same db file used for the map layout

Rember to insert db connection data in the file to include in the script header named  'database.php' and a pin image like 'pins/single.png'

    
 <?
include "database.php";

$dataQuery = date("Y-m-d");
$result = mysql_query("SELECT * FROM INPUTDATA where data > $dataQuery");
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1&mkt=it-IT"></script>
      <script type="text/javascript">
         var map = null;
        
         function GetMap()
         {
               map = new VEMap('myMap');
            map.LoadMap();
       
          
            
        
            var locs = new Array;
             var pinid=0;
                
         
             <?$count=0;
        
             while ($row = mysql_fetch_array ($result, MYSQL_BOTH))
    {
    $dataH = date("d-m-Y H:i:s",strtotime($row['data']));
    echo "
    var loc = new VELatLong(".$row['latitudine'].",".$row['longitudine'].");
               locs.push(loc);";
    if ($invia != "Nascondi dettagli")
    {echo "
    var pin = new VEPushpin($count, locs[$count], 'pins/single.png', 'Device $row[id_device]',
    'Data ora: $dataH    <br>Stato $row[state]     <br>Number $row[number]     <br>Car $row[car]     ');
              map.AddPushpin(pin);";
    }
    $count++;
   
    }       
              ?>
      
    var options = new VERouteOptions();
            options.RouteMode = VERouteMode.Walking;
            map.GetDirections(locs, options);
         }

      </script>
   </head>
   <body onload="GetMap();">
   <legend>Mappoint</legend>
 
      <div id='myMap' style="position:relative; width:800px; height:600px;"></div>
     
     
   

    <?
   
   
   
    mysql_close ($connection);
   
    ?>
   </body>
</html>