I have a typical polygon set on google map with some latLng's:
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);
these are the roots of the Bermuda Triangle from Google documentation. I also have some random coordinates, saaay:
var coord1 = new new google.maps.LatLng(26.194876675795218,-69.8291015625) var coord2 = new new google.maps.LatLng(33.194876675795218,-63.8291015625)
the first is inside the triangle, and the second is outside. These are just examples, but I need a way to find out if the provided coordinate (and not just one of these 2, any coordination) is inside or outside the polygon (also not always the Bermuda triangle, even the triangle - the polygons can have any number of latLng). I looked at the Google Maps API documentation, but I could not find any function that provides an answer to this question.
source share