Bonjour,

J'ai un champ "adresse" de type hidden qui contient une adresse.
Quand j'affiche la photo street view dans mon infowindow, le résultat me donne "Adresse approximative".
Effectivement, l'image ne correspond pas vraiment à l'adresse.
Y-a-t-il un moyen de rectifier ça ?

Merci.

Mon code :

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
96
97
98
99
100
101
102
103
104
105
106
107
108
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<style type="text/css">
#map-canvas {
	height : 800px;
	width : 1100px;
	margin: auto;
	}
</style>
 
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?sensor=false&language=fr">
</script>
 
<script type="text/javascript">
var geocoder;
var map;
// initialisation de la carte Google Map de départ
function initialiserCarte() {
geocoder = new google.maps.Geocoder();
// Latitude et longitude du centre de Paris pour centrer la carte de départ
var latlng = new google.maps.LatLng(48.8590519, 2.33254949999998);
 
  var mapOptions = {
    zoom      : 13,
    center    : latlng,
    mapTypeId : google.maps.MapTypeId.ROADMAP
  }
  // map-canvas est le conteneur HTML de la carte Google Map
  map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
 
function TrouverAdresse()
{
	// Récupération de l'adresse tapée dans le formulaire
	var adresse = document.getElementById('adresse').value;
	geocoder = new google.maps.Geocoder();
	geocoder.geocode( { 'address': adresse}, function(results, status) {
	if (status == google.maps.GeocoderStatus.OK)
		{
		// Création du marqueur du lieu (épingle)
		var marker = new google.maps.Marker({
			map: map,
			position: results[0].geometry.location,
			latitude: results[0].geometry.location.latitude,
			title: adresse
			});
		}
	else
		{
		alert('Adresse introuvable: ' + status);
		}
 
	var contentString = '<div id="content" style="width:400px;height:300px;"></div>';
	var infowindow = new google.maps.InfoWindow({
	content: contentString
	});
 
	infowindow.open(map,marker);
	google.maps.event.addListener(marker, 'click', function() {
	infowindow.open(map,marker);
	});
 
 
	var pano = null;
	google.maps.event.addListener(infowindow, 'domready', function() {
	if (pano != null) {
	pano.unbind("position");
	pano.setVisible(false);
	}
	pano = new google.maps.StreetViewPanorama(document.getElementById("content"), {
	navigationControl: true,
	navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
	enableCloseButton: false,
	addressControl: true,
	linksControl: true
	});
	pano.bindTo("position", marker);
	pano.setVisible(true);
	});
 
	google.maps.event.addListener(infowindow, 'closeclick', function() {
	pano.unbind("position");
	pano.setVisible(false);
	pano = null;
	});
 
});
 
}
 
// Lancement de la construction de la carte google map
google.maps.event.addDomListener(window, 'load', initialiserCarte);
</script>
</HEAD>
<BODY onload="TrouverAdresse();">
 
<form>
<center>
<div id="map-canvas"></div>
</center>
 
  <input type="hidden" id="adresse" value="17, rue ordener 75018 paris" size="50"/>
</form>
 
</BODY>
</HTML>