Google Maps v3: check if point exists in polygon

后端 未结 7 1922
-上瘾入骨i
-上瘾入骨i 2020-11-27 14:09

I am looking to find a way of checking if a point exists inside a polygon in Google Maps v3 (JavaScript). I\'ve searched everywhere and the only solutions I have found so fa

7条回答
  •  一个人的身影
    2020-11-27 14:24

    var coordinate = new google.maps.LatLng(0.457301,-0.597382);//replace with your lat and lng values
    var isWithinPolygon = google.maps.geometry.poly.containsLocation(coordinate, yourPolygon);
    

    Dont forget to include the library in your googleapis script. Read more...

    
    

提交回复
热议问题