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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| <!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>multi-marqueurs</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 600px; height: 550px;"></div>
<script type="text/javascript">
<!--
//['Jereme et Catherine Blondel', 49.898729,3.13606, 5],
TabCli = [
['Jean et Christophe','Paris',,],
['Laurent et Sabrina', 'Lyon',,],
['Gilbert et Marie', 'Busnes',,],
['Justine et Alex', 'Lens',,],
['Thibaud et Lucie', 'Marseille',,]
];
var geocoder;
geocoder = new google.maps.Geocoder();
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 6,
center: new google.maps.LatLng(47.4,1.6),
mapTypeControl: true,
mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
navigationControl: true,
navigationControlOptions: {
style: google.maps.NavigationControlStyle.SMALL,
position: google.maps.ControlPosition.TOP_RIGHT
},
scaleControl: true,
streetViewControl: false,
mapTypeId: google.maps.MapTypeId.ROADMAP
});
var infowindow = new google.maps.InfoWindow();
var i;
/*<REMPLISSAGE COORD (Lat + Lng) TABLEAU*/
for (i = 0; i < TabCli.length; i++) {
StockerLatLong(i);
}
/*REMPLISSAGE COORD (Lat + Lng) TABLEAU>*/
/*Fonctions*/
function StockerLatLong(eIndCli) {
/* Appel au service de geocodage avec l'adresse en paramètre */
geocoder.geocode( { 'address': TabCli[eIndCli][1]}, function(results, status) {
/* Si l'adresse a pu être géolocalisée */
if (status == google.maps.GeocoderStatus.OK) {
/* Récupération de sa latitude et de sa longitude */
TabCli[eIndCli][2] = results[0].geometry.location.lat();
TabCli[eIndCli][3] = results[0].geometry.location.lng();
} else {
alert("Le geocodage a échoué: " + status);
}
});
}
-->
</script>
</body>
</html> |
Partager