Google map marker check on existing


#1

Hi there again!
Im having some issues on checking is a marker was already set on map, when populating via ajax

Google maps api v3

When marker was added first time on zoom out google maps engine changes marker position.
How to check is it already added on map or not?

 function markerExists(lat, lng) {
    var exists = false;
    var cache = markerCache; 
var myLatLng = new google.maps.LatLng(lat, lng);
   angular.forEach(cache, function (record, i) {
        if(cache[i].getPosition().equals( myLatLng )){ 
            exists = true;
        }
    });

    return exists;
}

Same marker on different ZOOM states gives on console.log getPosition
Output:
zoom17, 41.346311 69.201538
zoom19, 41.351044, 69.178619