javascript - I am using MarkerClusterer to show more markers but when i have two markers on exact same location and when i click on cluster need to expand both -
i using markerclusterer show more markers when have 2 markers on exact same location , when click on cluster not expand want both separate click , show info window of that, user can see information of marker.
i following solution [click please] here not sufficient information me :(
i using right now
var markers = locations.map(function(location, i) { var marker = new google.maps.marker({ position: location, icon:{ url:location.marker, anchor: new google.maps.point(10,10), size: new google.maps.size(60,60.26), } }); google.maps.event.addlistener(marker, 'click', function(evt) { infowin.setcontent(location.info); infowin.open(map, marker); //infowin.open(map,this); }); google.maps.event.addlistener(infowin,'domready',function(){ $('.pop_service').closest('.gm-style-iw').parent().addclass('custom-iw'); }); var allmarkers = map.mapparams.mapmarkersarray; //final position marker, updated if marker exists in same position var finallatlng = latlng; //check see if of existing markers match latlng of new marker if (allmarkers.length != 0) { (i=0; < allmarkers.length; i++) { var existingmarker = allmarkers[i]; var pos = existingmarker.getposition(); //if marker exists in same position marker if (latlng.equals(pos)) { //update position of coincident marker applying small multipler coordinates var newlat = latlng.lat() + (math.random() -.5) / 1500;// * (math.random() * (max - min) + min); var newlng = latlng.lng() + (math.random() -.5) / 1500;// * (math.random() * (max - min) + min); finallatlng = new google.maps.latlng(newlat,newlng); } } } var marker = new google.maps.marker({ map: msf_namespace.mapparams.resultmap, position: finallatlng, title: name, icon: markericon }); //add each generated marker mapmarkersarray map.mapparams.mapmarkersarray.push(marker); //console.log(markercluster); return marker; }); google.maps.event.addlistener(map, "click", function(event) { if (infowin) { infowin.close(); } }); var markercluster = new markerclusterer(map, markers, { imagepath: clustermarkericon, imageextension:"svg", style:{ width:30, height:70, color:"#33cbcc", textcolor:"#33cbcc" } });
but return me error : typeerror: map.mapparams undefined
Comments
Post a Comment