title: Google Map API setCenter Method doesn't work
body: <p>So I have to add a "center" button to my page, which, when clicked the map will center on the pin by using setCenter Method. However, after I clicked my button, the maps goes blank instead of showing the center.</p>
  
  <p>this is my code.</p>
  
  <p>How to solve the problem?
  Thank you in advance!</p>
  
  <pre><code>&lt;script src="http://maps.google.com/maps/api/js?sensor=false"&gt;&lt;/script&gt;
  &lt;script&gt;
    function init() {
      var addButton = document.getElementById("setcenter");
      addButton.onclick = handleSetCenterButtonClicked;
      getMyLocation();
    }
  
  
    window.onload = init;
  
    function getMyLocation() {
      if (navigator.geolocation) {
          navigator.geolocation.getCurrentPosition(displayLocation);
      } else {
          alert("Oops, no geolocation support");
      }
    }
  
    function displayLocation(position) {
      showMap(position.coords);
      var latitude = position.coords.latitude;
      var longitude = position.coords.longitude;
      var div = document.getElementById("location");
      div.innerHTML = "You are at Latitude: " + latitude + ", Longitude: " + longitude;
    }
  
    var map;
    function showMap(coords) {
      var googleLatAndLong = new google.maps.LatLng(coords.latitude, coords.longitude);
      var mapOptions = {
          zoom : 18,
          center : googleLatAndLong,
          mapTypeId : google.maps.MapTypeId.SATELLITE
      };
      var mapDiv = document.getElementById("map");
      map = new google.maps.Map(mapDiv, mapOptions);
  
      addMarker(googleLatAndLong);
    }
  
    var marker;
    var markerArray = new Array();
  
    function addMarker(latLong) {
      var markerOptions = {
          position : latLong,
          map : map
      };
      marker = new google.maps.Marker(markerOptions);
  
      markerArray.push(marker);
    }
  
    // this is my setCenter method function
    function handleSetCenterButtonClicked(coords) {
  
      var latLng = new google.maps.LatLng(coords.latitude, coords.lotitude);
      map.setCenter(latLng);
    }
  
    // this is my setCenter method function
  &lt;/script&gt;
  </code></pre>