我需要确定某些LatLngs是否位于Google地图圈内(其中一个为http://code.google.com/apis/maps/documentation/javascript/overlays.html#Circles)。我该如何解决这个问题?我制作圈子的标记是:计算LatLng与LatLng之间的距离(或圆圈中的点数) - Google Maps v3
geocoder.geocode({ 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
circlemarker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
THEradius = parseFloat(THEradius);
var populationOptions = {
strokeColor: "#BDAEBB",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#BDAEBB",
fillOpacity: 0.5,
map: map,
center: results[0].geometry.location,
radius: THEradius
};
cityCircle = new google.maps.Circle(populationOptions);
map.fitBounds(cityCircle.getBounds());
}
});
我可以使用半径吗?
顺便说一句,你**不能**使用毕达哥拉斯定理,因为地球是不平坦的! – kargeor
在网站上的第一个很好的答案,非常感谢,绝对是最好的解决方案和我正在寻找的。你知道这个选项是否有任何请求限制? – rickyduck
该文档没有提到任何限制。我不确定该函数是在本地还是在服务器上进行评估。 – kargeor