Bonjour,

j'ai fait un petit script google map pour afficher une carte avec 3 points :
- 1 point d'arrivée (point0)
- 2 autrees points (point1 et point2)
Le code est écrit pour que le point d'arrivée soit affiché avec une icone différente des points 1 et 2.
Seul probleme, le script n'affiche que le point d'arrivée et pas les 2 autres points, alors que j'ai suivi la doc sur http://www.google.fr/apis/maps/documentation/

Mon code est en dessous
Si jamais vous voyez le probleme...merci !



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
<html>
<head>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAal_cd43vOKPQhNkPDkwHgBQSXE4ITa1YzwIbIoQt-CisjCLm8xTJhtTXHvXoMcij_eu3bNbEGnk_PA" type="text/javascript"></script>
</head>
<body>
 
<?php 
$lat0=48.847043;
$long0=2.295967;
$lat1=48.831764;
$long1=2.302745;
$lat2=48.870227;
$long2=2.297948;
?>
 
 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
 
  <body onunload="GUnload()">
 
 
    <div id="map" style="width: 550px; height: 450px"></div>
 
    <noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b> 
      However, it seems JavaScript is either disabled or not supported by your browser. 
      To view Google Maps, enable JavaScript by changing your browser options, and then 
      try again.
    </noscript>
 
 
    <script type="text/javascript">
    //<![CDATA[
 
    if (GBrowserIsCompatible()) { 
 
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(<?php echo "$lat0,$long0" ; ?>), 13);
// Creates a marker at the given point with the given number label
 
 function createMarker(point, number) {  var marker = new GMarker(point);
 GEvent.addListener(marker, "click", function() {    marker.openInfoWindowHtml("Marker #<b>" + number + "</b>");
 });
 return marker;
 }
 
 	  //Création d´une icone personnalisé.
	  var icone = new GIcon();
	  icone.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
	  icone.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	  icone.iconSize = new GSize(12, 20);
	  icone.shadowSize = new GSize(22, 20);
	  icone.iconAnchor = new GPoint(6, 20);
	  icone.infoWindowAnchor = new GPoint(5, 1);
 
	   var point0 = new GLatLng(<?php echo "$lat0,$long0" ; ?>);
 
	  // marqueur du point d'arrivée
	  var marqueur_arrivee = new GMarker(point0, icone);  
      map.addOverlay(marqueur_arrivee);
	  marqueur.openInfoWindowHtml("<b>Votre lieu d'arrivee</b>");
 
 // Add 10 markers to the map at random locations
 
 var point1 = new GLatLng(<?php echo "$lat1,$long1" ; ?>);  map.addOverlay(createMarker(point1, 1));	
 var point2 = new GLatLng(<?php echo "$lat2,$long2" ; ?>);  map.addOverlay(createMarker(point2, 2));	
	}
    // display a warning if the browser was not compatible
    else {
      alert("Désolé, Google Maps API n'est pas compatible avec votre navigateur");
    }
 
    //]]>
    </script>
 
<!-- --End Map Search Solution Wizard Generated Code-- -->
 
</body>
</html>