Bonjour à tous,

Je souhaiterais ajouter un marker personnalisé sur google map , mais je n'y arrive pas

J'ai lu pas mal de choses à ce sujet, mais ne maîtrisant pas le javascript, je galère.

Quelqu'un pourrait-il m'aider svp ?

Voici le code qui fonctionne, mais avec des markers standard.

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
 
 
<!DOCTYPE html>
<html lang="fr">
	<head>
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
		<meta charset="UTF-8" />
		<title>Titre de votre page</title>
		<style type="text/css">
			html {
				height: 100%
			}
			body {
				height: 100%;
				margin: 0;
				padding: 0
			}
			#EmplacementDeMaCarte {
				height: 100%
			}
		</style>
		<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
		<script type="text/javascript">
			function initialisation(){
				var centreCarte = new google.maps.LatLng(42.617718, 2.423230999999987);
				var optionsCarte = {
					zoom: 16,
					center: centreCarte,
					mapTypeId: google.maps.MapTypeId.ROADMAP
				};
				var maCarte = new google.maps.Map(document.getElementById("EmplacementDeMaCarte"), optionsCarte);
 
	 <!-- var optionsMarqueur = {position: new google.maps.LatLng(x,y),	map: maCarte};var marqueur = new google.maps.Marker(optionsMarqueur);	 -->			
 
 
				var optionsMarqueur = {
					position: new google.maps.LatLng(42.614920, 2.426644),
					map: maCarte
				};
 
 
				var marqueur = new google.maps.Marker(optionsMarqueur);
 
				var image = new google.maps.MarkerImage('c:/marker travaux.png');
 
				var optionsMarqueur = {
					position: new google.maps.LatLng(42.614119, 2.420700),
 
					map: maCarte,
 
					title:"travaux en cours" ,
 
					icon: image				
 
				};
 
				var marqueur = new google.maps.Marker(optionsMarqueur);
			 }
			 google.maps.event.addDomListener(window, 'load', initialisation);
		</script>
	</head>
 
	<body>
		<div id="EmplacementDeMaCarte"></div>
 
	</body>
</html>
J'ai fais des essais avec l'image en question sur mon HDD, mais logiquement elle est hébergée , je l'ai mise ici : http://imagesia.com/marker-travaux_twnk

enfin, je voudrais qu'en cliquant sur cet icone de la Map, ça renvoie vers une page de mon site.

Merci beaucoup pour votre aide

Eddy