I try to get all the markers within a given radius ( google.maps.Circle ) using google.maps.geometry.poly.containsLocation as recommended here , but I get an error: TypeError: e is undefined .
Excerpt
// ... if (google.maps.geometry.poly.containsLocation(randomMarkers[i].marker.getPosition(), searchArea)) { console.log('=> is in searchArea'); } else { console.log('=> is NOT in searchArea'); } // ...
Full code :
<!DOCTYPE html> <html> <head> <title>Simple Map</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="utf-8"> <style> html, body, #map-canvas { height: 100%; margin: 0px; padding: 0px } </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script> <script> var map, searchArea, searchAreaMarker, searchAreaRadius = 1000, </script>
Thanks in advance!
IN.
Mr. B. source share