10-07-2015, 11:05 PM
J'obtient ceci :
Code PHP :
<?php
var AIRPORT_DATA = [["resultat de la requete"]]
<script type="text/javascript">
function initialiser() {
var latlng = new google.maps.LatLng(46.779231, 6.659431);
var options = {
center: latlng,
zoom: 4,
streetViewControl: false,
mapTypeControl:false,
};
var carte = new google.maps.Map(document.getElementById("carte"), options);
/****************Nouveau code****************/
//redéfinition du centre de la carte
carte.setCenter(new google.maps.LatLng(49.00969060, 2.547924500));
//redéfinition du zoom
carte.setZoom(4);
//création du marqueur
for (var i in AIRPORT_DATA) {
var airport = AIRPORT_DATA[i];
var marqueur = new google.maps.Marker({
position: new google.maps.LatLng(airport.latitude, airport.longitude),
map: carte,
icon: "http://www.durhamcollege.ca/wp-content/uploads/campus-status-green.png" ,
});
var infoBulle = new google.maps.InfoWindow({
'position' : new google.maps.LatLng(airport.latitude, airport.longitude),
'content' : airport.aeroport + ' [' + airport.code + ']',
});
google.maps.event.addListener(marqueur, 'click', function() { infoBulle.open(carte, this); });