1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
<script type="text/javascript">
var infoBulle = new google.maps.InfoWindow();
var map;
function initCarte(){
var mapOptions = {
center: new google.maps.LatLng(Liste_des_points[Liste_des_points.length-1][1], Liste_des_points[Liste_des_points.length-1][2]),
zoom: 1,
mapTypeId: google.maps.MapTypeId.HYBRID
};
map = new google.maps.Map(document.getElementById("div_carte"),mapOptions);
var contenuInfoBulle
var bounds = new google.maps.LatLngBounds();
var flightPlanCoordinates = new Array();
for(var i=0;i<Liste_des_points.length;i++){
flightPlanCoordinates.push(new google.maps.LatLng(Liste_des_points[i][1],Liste_des_points[i][2]));
var latLng = new google.maps.LatLng(Liste_des_points[i][1],Liste_des_points[i][2]);
//bounds.extend(latLgn);
var marker = new google.maps.Marker({
map: map,
flat:true,
title:Liste_des_points[i][0],
position: latLng
});
contenuInfoBulle = '<h2>'+Liste_des_points[i][0]+'</h2>' +
'<h3> Date : '+Liste_des_points[i][3]+'</h3>';
bindInfoWindow(marker, contenuInfoBulle);
}
var flightPath = new google.maps.Polyline({
path: flightPlanCoordinates,
strokeColor: "#FF0000",
strokeOpacity: 1.0,
strokeWeight: 2
});
//bounds.getCenter();
//map.fitBounds(bounds);
flightPath.setMap(map);
function bindInfoWindow(marqueur, info) {
google.maps.event.addListener(marqueur, 'click', function() {
infoBulle.setContent(info);
infoBulle.open(map, marqueur);
});
}
}
google.maps.event.addDomListener(window, 'load', initCarte);
</script> |
Partager