检查点是否位于多边形中(谷歌地图API)
所以我有一张地图 如何使用GoogleMapsAPI检测给定坐标是否在该多边形内?可能吗检查点是否位于多边形中(谷歌地图API),api,google-maps,polygon,point-in-polygon,Api,Google Maps,Polygon,Point In Polygon,所以我有一张地图 如何使用GoogleMapsAPI检测给定坐标是否在该多边形内?可能吗 提前谢谢。是的,这是可能的。查看此功能:谷歌已经提供了一个 var bermudaTriangle = new google.maps.Polygon({ paths: [ new google.maps.LatLng(25.774, -80.190), new google.maps.LatLng(18.466, -66.118), new google.m
提前谢谢。是的,这是可能的。查看此功能:谷歌已经提供了一个
var bermudaTriangle = new google.maps.Polygon({
paths: [
new google.maps.LatLng(25.774, -80.190),
new google.maps.LatLng(18.466, -66.118),
new google.maps.LatLng(32.321, -64.757)
]
});
google.maps.event.addListener(map, 'click', function(event) {
console.log(google.maps.geometry.poly.containsLocation(event.latLng, bermudaTriangle));
});