title: Google Maps v3 - How to center using an address on initialize?
body: <p>Using Google Maps API v3, is there a way to set the center of the map on initialize? I have a workaround using this code:</p>
  
  <pre><code>var geocoder;
    var map;
    function initialize() {
      geocoder = new google.maps.Geocoder();
      var latlng = new google.maps.LatLng(-34.397, 150.644);
      var myOptions = {
        zoom: 8,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      codeAddress('germany');
    }
  
    function codeAddress(address) {
      geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          map.setCenter(results[0].geometry.location);
          var marker = new google.maps.Marker({
              map: map,
              position: results[0].geometry.location
          });
        }
      });
    }
  </code></pre>
  
  <p>The only problem is that when it initializes, it centers it to the "latlng" for a split second. I'm can't figure out how to set the center in "myOptions".  I though I could return "results[0].geometry.location" from the codeAddress function and pass it to myOptions, but that doesn't work.</p>
  
  <p>Thanks for any help. </p>
  
  <p><strong>Update</strong>
  Since I can't remove "center" altogether, I'm wondering if there's a way to pass the address to the options.</p>
  
  <blockquote>
    <p>From Google API:</p>
    
    <p>To initialize a Map, we first create a Map options object to contain map initialization variables.
    This object is not constructed; instead it is created as an object literal. There are two required
    options for every map: <em>center</em> and <em>zoom</em>.</p>
  </blockquote>