Col*_*lin 7 math google-maps google-maps-api-3
我正在使用谷歌地图,我需要能够在5英里半径的邮政编码中心周围进行搜索,所以我认为最简单的方法就是找出纬度/经度到里程的转换.
以下是使用Google的Geometry库的基本概念.
请记住添加几何库.它与Google地图库分开.
<script type="text/javascript" 
  src="http://maps.googleapis.com/maps/api/js?libraries=geometry&sensor=false">
</script>
示例用法:
    //the distance function defaults to km.  
    //to use miles add the radius of the earth in miles as the 3rd param.
    //earths radius in miles == 3956.6
    var distance = 
      google.maps.geometry.spherical.computeDistanceBetween(
            /* from LatLng */, 
            /* to LatLng */, 
            /* radius of the earth */
      );
    if (distance <= 5) { //less or equal to five miles
        var marker = new google.maps.Marker({
            map: map,
            position: //LatLng
        });              
    }
我有一个例子小提琴的这个动作.