title: How to preserveViewport with Drive KML file embed in google maps api v3
body: <p>EDIT: Solved:</p>
  
  <pre><code>var opt = { minZoom: 6, maxZoom: 9 };
    map.setOptions(opt);
  </code></pre>
  
  <p>I'm a cut-and-paste coder and while I intend on learning the syntax better, I'm on a deadline for now so I'm asking for help. I have googled extensively and while there are solutions to my problem, I haven't found one that works for me. My KML file is hosted on Google Drive so instead of a file url there is a driveFileId.</p>
  
  <p>If you want to preserveViewport, you normally just add it to the layer object and set it to 'true'. However my KML file won't let me override its default zoom level where the bounds fit the screen no matter how I write it. Can someone help? This is the working object:</p>
  
  <pre><code>var layer = new google.maps.KmlLayer({
  driveFileId: "0Bexampleg"});
  layer.setMap(map);
  </code></pre>
  
  <p>EDIT: Here's the whole thing. Perhaps you can see if there are redundancies or contradictions that are causing this.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src="http://maps.google.com/maps/api/js?key=Aexamplekey0&amp;sensor=true"&gt;&lt;/script&gt;
      &lt;style&gt;
          #map {
              width: 310px;
              height: 410px;
          }
      &lt;/style&gt;
  
      &lt;script&gt;
          window.onload = function () {
  var latlng = new google.maps.LatLng(53.385873, -1.471471);
  
  var styles = [
    {
      //whatever
    }
  ]
  
  var myOptions = {
  zoom: 15,
              disableDefaultUI: false,
                  styles: styles
              },
  
              map = new google.maps.Map(document.getElementById('map'), myOptions);
  
  var layer = new google.maps.KmlLayer({
      driveFileId: "0Bexampleg"});
  layer.setMap(map);
  }
  google.maps.event.addDomListener(window, 'load', initialize);
      &lt;/script&gt;
  
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;div id="map"&gt;&lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>