Ver Mensaje Individual
  #3  
Antiguo 03-05-2007
halizia halizia is offline
Miembro
 
Registrado: abr 2006
Posts: 116
Reputación: 19
halizia Va por buen camino
Código PHP:
<?
function dibujarmapa(){
        
$plantas=consulta_todas_plantas();
                    
$datos=array();
                    
$i=0;
                    foreach(
$plantas->row as $row){
                        
$pl=consulta_datosplanta_segun_id_planta($row->id_installation);
                        if (
$pl->row->latitude_degree>0){
                             
$lat=round($pl->row->latitude_degree+($pl->row->latitude_minute/60),3);
                          }else{
                             
$lat=round($pl->row->latitude_degree-($pl->row->latitude_minute/60),3);
                          }
                          if (
$pl->row->longitude_degree>0){
                              
$long=round($pl->row->longitude_degree+($pl->row->longitude_minute/60),3);
                          }else{
                            
$long=round($pl->row->longitude_degree-($pl->row->longitude_minute/60),3);
                          }
                        
$datos[$i][0]=$lat;
                        
$datos[$i][1]=$long;
                        
$i++;
                        
//echo $row->name." ".$lat." ".$long."<br>";
                    
}
    
?>
                    <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Google estado_historico_grupo JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;hl=es&amp;key=clave" charset="iso-8859-1"
            type="text/javascript"></script>
    <script type="text/javascript">
    
    function load() {
      if (GBrowserIsCompatible()) {
      

        var map = new GMap2(document.getElementById("map"));
        //map.setMapType(new GMapType("G_HYBRID_MAP"));
        
         
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        
        map.setCenter(new GLatLng(40,-3), 5);//centrar en madrid
        
        // Create our "tiny" marker icon
        var icon = new GIcon();
        icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
        icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
        icon.iconSize = new GSize(12, 20);
        icon.shadowSize = new GSize(22, 20);
        icon.iconAnchor = new GPoint(6, 20);
        icon.infoWindowAnchor = new GPoint(5, 1);
        //situar el icono
        var point = new GLatLng(42,1);//aqui iría el acceso al array pero no sé cómo hacerlo
        map.addOverlay(new GMarker(point, icon));
         map.setMapType(G_HYBRID_TYPE);
      }
    }

    </script>
  </head>
  <body onload="load()" onunload="GUnload()">
    <div id="map" style="width: 500px; height: 300px"></div>
  </body>

</html>
<?
    
}
Responder Con Cita