var bounds = new google.maps.LatLngBounds();
var i;

// The Bermuda Triangle
var polygonCoords = [
  new google.maps.LatLng(25.774252, -80.190262),
  new google.maps.LatLng(18.466465, -66.118292),
  new google.maps.LatLng(32.321384, -64.757370),
  new google.maps.LatLng(25.774252, -80.190262)
];

for (i = 0; i < polygonCoords.length; i++) {
  bounds.extend(polygonCoords[i]);
}
/// alert the center
alert(bounds.getCenter());  //the center is polygon center

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-27
  • 2021-11-30
  • 2021-10-05
  • 2021-06-02
  • 2021-11-24
  • 2021-11-11
猜你喜欢
  • 2022-12-23
  • 2021-09-02
  • 2022-12-23
  • 2021-08-11
  • 2021-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案