I have markers dotted around a map, and a radius (circle overlay) on a marker marking your location (which changes every time you move).
Is there any way I can check to see if the other markers come inside the circle?
UPDATE
I got around this by looping through each other marker, and using the geometry library calculating the distance between your marker and the other marker and then a simple if statement to see if it's less than 100 meters.
function checkAllChests() {
var Current = 0;
$.each(treasureArray, function() {
//var thisLocation = treasureArray[Current].getPosition();
var distanceBetween = Math.ceil(google.maps.geometry.spherical.computeDistanceBetween(treasureArray[Current].getPosition(), marker_me.getPosition()));
if(distanceBetween < 100) {
alert('CAN OPEN THIS CHEST');
}
Current++;
});
}
I'd like to note that the above code uses jQuery, so if you aren't using jQuery it won't work.