zoukankan      html  css  js  c++  java
  • Google Map Api V3 系列之 Polygon 获取中心点方法

    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

    人生的无奈那么多谁可以数得清?请告诉我!别回头走自己的路,就算有些事让人无助,至少我有一路吃苦的幸福!多年以后当我抬头望天空,湛蓝的色彩中依然有我沉郁多年的思绪!回归那一季那个曾叫‘山子’的男孩纯洁的微笑,然后宿命收拢指间,我们无处可逃
    作者:Love Coding
    出处:http://www.cnblogs.com/youshan/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    Servlet & JSP
    Servlet & JSP
    Servlet & JSP
    Servlet & JSP
    Servlet & JSP
    Servlet & JSP
    Table of Contents
    Commons Codec
    14.Longest Common Prefix
    628.Maximum Product of Three Numbers
  • 原文地址:https://www.cnblogs.com/youshan/p/2482793.html
Copyright © 2011-2022 走看看