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
| <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAIMHCq4Nim65CW8qV_t-SFxRExG8cKfrJ0qMqh_GMjmpdKQOhQRTI8b3wdvtPEf2eSAFvPR65LDtjbQ" type="text/javascript"></script>
<script type="text/javascript">//<![CDATA[
function load()
{
if (GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("map"));
//map.setCenter(new GLatLng(COODONNÉES DU CENTRE), VALEUR DU ZOOM)
//ZOOM DE 1 a 17
map.setCenter(new GLatLng(49.8, 2.4), 17);
// Initialisation de l'objet "GClientGeocoder"
geocoder = new GClientGeocoder();
// Initialisation de l'adresse
adresse = "<?php echo $rue." ".$ville;?>";
// Appel de la fonction d'affichage de l'adresse
showAddress(adresse);
}
}
// Fonction de geocoding.
// Transformation d'une adresse en coordonnées
function showAddress(address)
{
if (geocoder)
{
geocoder.getLatLng(address, function(point)
{
if (!point) {alert(address + " L'adresse rentrer n'existe pas");} // Adresse non connue par Google Maps
else
{
var marker = new GMarker(point); // Initialisation d'un marker
map.addOverlay(marker); // Affichage du marker
marker.openInfoWindowHtml(address); // Affichage d'une bulle contenant l'adresse
}
});
}
}
//]]></script> |
Partager