title: Openlayers initial extent
body: <p>According to the OpenLayers documentation, the constructor, OpenLayers.Map(), allows for an additional property <em>extent</em> which is <em>"The initial extent of the map"</em> (<a href="http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.OpenLayers.Map" rel="nofollow">see here</a>).</p>
  
  <p>However, I cannot get it to have any effect. I know I can set an initial extent by calling <em>.zoomToExtent()</em> <strong>after</strong> constructing the map. But I would like to use this <em>extent</em> property because I set a <em>zoomend</em> event in the <em>eventListeners</em> property but don't want it to trigger with an initial call to <em>.zoomToExtent()</em>. Does anyone have a clue how to use this <em>extent</em> property?</p>
  
  <p>This is the code that isn't working</p>
  
  <pre><code>map = new OpenLayers.Map('map',{
          extent: bounds,
          layers: [osmLayer,vectorLayer],
          projection: "EPSG:900913",
          eventListeners: {
              zoomend: function() {
                  //..zoomend event listener code
              }
          }
      });
  </code></pre>
  
  <p>In the above example:</p>
  
  <ul>
  <li><em>bounds</em> is a valid <em>OpenLayers.Bounds</em> object</li>
  <li><em>osmLayer</em> and <em>vectorLayer</em> are valid <em>OpenLayers.Layer</em> objects of which <em>osmLayer</em> is the base layer.</li>
  </ul>
  
  <p>What happens with above code is that the map is completely zoomed out (in fact you can't actually see anything) and any attempts to pan results in errors being thrown. To get to map into a correct state the user has to zoom in and then panning works again and you can see the map.</p>