Bonjour,

j'ai voulu intégrer un module de localisation dans ma carte mais cela ne fonctionne pas.
Ma carte est alimenté par un fichier XML, ci quelqu'un à une idée ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
   <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
   <title>Utilisation de XML</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAFhJ6OnZIlZXbu_0iBMpJTxSvbdqi1ffVObny9uVPFoaHpJSaYRSytX3qJt17I3qM_yj9XwrSitmomQ" type="text/javascript"></script>
 
    <script type="text/javascript">
 
	//<![CDATA[
 
    function load() {
    	if (GBrowserIsCompatible()) {
        	// Creation d'une carte
			var map = new GMap2(document.getElementById("map"));
           	map.addControl(new GSmallMapControl());
           	map.addControl(new GMapTypeControl());
           	//map.setCenter(new GLatLng(44.554, 1.505), 8);
 
			function creerMarker(point, onglet1, onglet2, iconePerso) {
				var toto = new GIcon(iconePerso);				
				var marker = new GMarker(point,iconePerso);
 
				var infoTabs = [
				new GInfoWindowTab("Adresse", onglet1),
				new GInfoWindowTab("Détails", "Test détails")
				];
 
				GEvent.addListener(marker, "click", function() {
					marker.openInfoWindowTabsHtml(infoTabs);
				});
				return marker;
			}
 
			GDownloadUrl("http://infacosas.ifrance.com/cartesGPI/donnees.xml", function(data) {
				var xml = GXml.parse(data);
				var markers = xml.documentElement.getElementsByTagName("marker");
				for (var i = 0; i < markers.length; i++) {
					var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")), 9);
					var monIcone = new GIcon();
					monIcone.iconSize = new GSize(32,32);
					monIcone.shadowSize = new GSize(16,16);
					monIcone.iconAnchor = new GPoint(16,32);
					monIcone.infoWindowAnchor=new GPoint(16,0);
					monIcone.image = markers[i].getAttribute("icone");
					var infoHtml = "<div align='center'><B>"+markers[i].getAttribute("nom")+"</B></div><div align='center'>"+markers[i].getAttribute("adresse")+"</div><div align='center' style='color:blue';>"+markers[i].getAttribute("cpville")+"</div>";
					var marker = creerMarker(point, infoHtml, markers[i].getAttribute("details"), monIcone);
					map.addOverlay(marker);
					//alert(markers[i].getAttribute("info"));
				}
           });
        }
    }
 
	/* Creation de l'objet GclientGeocoder */
	var geocoder = new GClientGeocoder();
 
	/* Fonction qui permet de déplacer la carte sur une adresse donnée */
	function showAddress(address) {
        if (geocoder) {
            geocoder.getLatLng(address, function(point) {
                if (!point) { /* Si les coordonnées n'ont pas été trouvés */
                    alert("Impossible de localiser l'adresse :\n\n" + address);
                } else { /* /* Les coordonnées ont été trouvés */
                    alert("coucou !");
					/* Centrer la carte sur le point */
                    map.setCenter(point, 15);
                    /* Création d'un marqueur */
                    var marker = new GMarker(point);
                    /* Afficher le marqueur */
                    map.addOverlay(marker);
                    /* Associer une info-bulle au marqueur */
                    marker.openInfoWindowHtml(address);
                }
            });
        }
    }
    //]]>
    </script>
    </head>
 
<body onload="load()" onunload="GUnload()">
 
	<form action="#" method="post" onsubmit="showAddress(address.value); return false;"> 
		<input type="text" id="address" name="address" value="Tour Eiffel, Paris, France" /> 
		<input type="submit" id="submit" value="Localiser" /> 
	</form>
 
	<div id="map" style="width: 1000px; height: 600px"></div>
 
 
</body>
</html>
Merci bien car je nage complet