裏面我的LatLng有一個典型的多邊形谷歌地圖與一些的latLng的設定:是多邊形
var bermudaTriangle = new google.maps.Polygon({
paths: [
new google.maps.LatLng(25.774252, -80.190262),
new google.maps.LatLng(18.466465, -66.118292),
new google.maps.LatLng(32.321384, -64.75737),
]
});
bermudaTriangle.setMap(map);
這些都是谷歌的文檔中的百慕大三角COORDS。我也有一些隨機座標,saaay:
var coord1 = new new google.maps.LatLng(26.194876675795218,-69.8291015625)
var coord2 = new new google.maps.LatLng(33.194876675795218,-63.8291015625)
第一個恰好在三角形內,第二個在外面。這些只是一個例子,我需要的是一種方法來找出,如果一個提供的座標(不只是這兩個座標中的一個)在多邊形的內部或外部(也不總是百慕大三角形,甚至不是三角形 - 多邊形可以有任意數量的latLng)。我瀏覽了Google Maps API文檔,但找不到任何提供 這個問題的答案。