How to use containsLocation in Google maps geometry library.

google-maps, google-maps-api-3

Solution

Oke, stupid me

I was wrong using all the coords as an array, I had to use the created polygon object.

var polyOptions = {
 ...
}

draw = new google.maps.Polygon(polyOptions);
draw.setMap(map);

if(google.maps.geometry.poly.containsLocation(point, draw) == true) {
 alert("yes");
}

Problem

I am trying to use the `containsLocation` from the Google geometry library, but can't get it to work... ``` var point = new google.maps.LatLng(51.331, 3.538); var poly = [ new google.maps.LatLng(51.401818509550615, 3.547626782103622), new google.maps.LatLng(51.397574277049365, 3.563607598960424), new google.maps.LatLng(51.398540111384975, 3.567880788749134), ... // it is a lot bigger ]; if(google.maps.geometry.poly.containsLocation(point, poly) == true) { alert("yes"); } ``` The Javascript console gives an error, but that points to a function in Google's lib. So I assume the problem should lie somewhere in this function.

Original source