相关疑难解决方法(0)

检查纬度和经度是否在圆圈谷歌地图内

以下是我想要的结果

在此输入图像描述

我想知道的是:

我使用中心点lat lang和它周围的半径创建了圆.现在我想知道,如果你可以在Javascript中给我代码示例,如何检查(计算)纬度和经度是否在该区域内部或外部我将不胜感激.我正在使用Google Maps API V3.

我找到了这个功能,但没有像我预期的那样工作:

function arePointsNear(checkPoint, centerPoint) {
    var sw = new google.maps.LatLng(centerPoint.lat() - 0.005, centerPoint.lng() - 0.005);
    var ne = new google.maps.LatLng(centerPoint.lat() + 0.005, centerPoint.lng() + 0.005);
    var bounds = new google.maps.LatLngBounds(sw, ne);
    if (bounds.contains (checkPoint)){
        return true;
    }
    return false;
}
Run Code Online (Sandbox Code Playgroud)

任何帮助都会很棒..提前感谢!!

javascript google-maps google-maps-api-3

6
推荐指数
1
解决办法
1万
查看次数