title: Calculate the center point of multiple Lat/Long
body: <p>I am using Google Map to display multiple lat/long points.</p>
  
  <p>But the Google map Javascript code has the code snippet to track the center of lat/long of the available lat/long.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var locations = JSON.parse('&lt;?php echo json_encode($data);?&gt;'); //alert (locations);
      var map = new google.maps.Map(document.getElementById('map'), {
          zoom: 10,
          center: new google.maps.LatLng(),
          mapTypeId: google.maps.MapTypeId.ROADMAP
      });
  
      var infowindow = new google.maps.InfoWindow();
  
      var marker, i;
  
      for (i = 0; i &lt; locations.length; i++) {
  
          marker = new google.maps.Marker({
              position: new google.maps.LatLng(locations[i][2], locations[i][3]),
              map: map
          });
  
          google.maps.event.addListener(marker, 'click', (function(marker, i) {
              return function() {
                  infowindow.setContent(locations[i][1]);
                  infowindow.open(map, marker);
              }
          })(marker, i));
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>In Above code the line</p>
  
  <pre><code>center: new google.maps.LatLng(),
  </code></pre>
  
  <p>needs a lat/long pair which could be the center point of multiple lat/long to be displayed.</p>
  
  <p>How could that be done?</p>