![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
09/11/2012, 14:36
|
| | Fecha de Ingreso: junio-2011
Mensajes: 342
Antigüedad: 13 años, 7 meses Puntos: 5 | |
Respuesta: For PHP en API Google Maps Cita:
Iniciado por rolygc
Código:
(function()
{
var lat = [], lon = [], icao = [], city = [];
var i = 0;
<?php if ( mysql_num_rows($query) > 0): ?>
<?php while ( $row = mysql_fetch_assoc($query) ): ?>
lat[i] = <?php echo $lat[$c]['Lan']; ?>;
lon[i] = <?php echo $lon[$c]['Lon']; ?>;
icao[i] = <?php echo $lat[$c]['ICAO']; ?>;
city[i] = <?php echo $lat[$c]['CITY']; ?>;
i++;
<?php endwhile; ?>
<?php endif; ?>
var latLonCenter = new google.maps.LatLng( lat[0], lon[0] );
window.onload = function()
{
var options = {
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById( 'map_canvas' ), options);
for ( var i = 0; i < lat.length; i++ )
{
var latLng = new google.maps.LatLng( lat[c], lon[c] );
getMarker( latLng, icao[c], city[c] );
}
map.setCenter(latLonCenter);
}
function getMarker(latLng, icao, city)
{
var image = 'http://mapicons.nicolasmollet.com/wp-content/uploads/mapicons/shape-default/color-d22328/shapecolor-color/shadow-1/border-dark/symbolstyle-white/symbolshadowstyle-dark/gradient-no/airport.png';
marker = new google.maps.Marker({
position: latLng,
map: map,
draggable: false,
animation: google.maps.Animation.DROP,
icon: image,
title: icao + ' ' + city
});
}
})();
Esto dónde lo coloco? Aquí dónde creas el InfoWindow? |