Bonjour,

voici un code recupere sur google api.

Quelque soit le zoom que j'inscris (ici 5), google fait toujours un zoom auto afin que tous les marqueurs soient affiches. Comment faire pour supprimer ce zoom auto

Code : Sélectionner tout - Visualiser dans une fenêtre à part
map.setCenter(new GLatLng(42.351505,-71.094455), 5);
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
<!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"  xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <title>Google Maps JavaScript API Example: Simple Directions</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <script src="http://maps.google.com/maps?file=api&v=2.x&key=nA"
      type="text/javascript"></script>
    <script type="text/javascript"> 
	// Create a directions object and register a map and DIV to hold the 
    // resulting computed directions
 
    var map;
    var directionsPanel;
    var directions;
 
    function initialize() {
      map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(42.351505,-71.094455), 5);
      directionsPanel = document.getElementById("route");
      directions = new GDirections(map, directionsPanel);
      directions.load("from: 500 Memorial Drive, Cambridge, MA to: 4 Yawkey Way, Boston, MA 02215 (Fenway Park)");
    }
    </script>
  </head>
 
  <body onload="initialize()">
    <div id="map_canvas" style="width: 70%; height: 480px; float:left; border: 1px solid black;"></div>
    <div id="route" style="width: 25%; height:480px; float:right; border; 1px solid black;"></div>
    <br/>
  </body>
</html>
Merci de votre aide