title: KmlLayer getDefaultViewport() Undefined- Google Maps
body: <p>Thanks for your times, i wish i will be clear enough to talk about my small issue.
  I woud like to use a variable "coor" like this:</p>
  
  <pre><code>var coor = kml.getDefaultViewport().getCenter();
  </code></pre>
  
  <p>and use this variable to a new MARKER Position.
  The problem is: javaScript returns Undefined.</p>
  
  <p>This is my code:</p>
  
  <pre><code>    function initialisation(){
      var centreCarte = new google.maps.LatLng(liste[0][2], liste[0][3]);
      var optionsCarte = {
          zoom: 7,
          center: centreCarte,
          mapTypeId: google.maps.MapTypeId.ROADMAP}                           
      var maCarte = new google.maps.Map(document.getElementById("EmplacementDeMaCarte"), optionsCarte);
  
      var i=0,li=liste.length;
      while(i&lt;li){
      var kml = new google.maps.KmlLayer('http://myestory.fr/kml/'+liste[i]                [0].toString()+'.kml',
                          {
                          'preserveViewport': true,
                          'map': maCarte
                          });
  
      var coor = kml.getDefaultViewport().getCenter();
  
      var marker = new MarkerWithLabel({
      position: new google.maps.LatLng(coor),
      map: maCarte,
      ... //other options of MarkerWithLabel
      });
      i++;}
      }
  
      google.maps.event.addDomListener(window, 'load', initialisation);
  
      &lt;/script&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>So do you know why variable "coor" doesn't take any values?
  And is there any other solutions?</p>
  
  <p>Thanks!!</p>
  
  <p>Cz</p>