Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49188

Google map marker check on existing

$
0
0

@cybernatic wrote:

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

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>