Welcome guest, please Login or Register

EEC.MS - ExpressionEngine add-ons

You are here: HomeForum Home → Free add-ons → Modules → Thread

   

[example complete] how to implement MarkerClusterer into mxgoogleMaps

Rank

Total Posts: 3

Joined 2012-01-27

PM

Hi, I want to implement this functionality MarkerCluster into this code

$(document).ready(function() 
        
$("#map").mxgoogleMaps({
            latitude
:  51.403466,
            
longitude:  -1.315185,
            
zoom:  8,
            
markers:     [{marker_id 327,
            
latitude:  51.873425,
            
longitude:  0.082221,
            
draggablefalse,
            
icon"cat-5.png",
            
infow:"<div class='infowindow'><a href='/network/profile/327' title='View Full Information' class='image'><img src='/images/avatars/default.png' title='Sabine' width='50' height='50'></a><h3><a href='/network/profile/327'>Dr Sabine Apitz</a></h3><h4>SEA Environmental Decisions Ltd.<h4><a href='/network/profile/327' title='View Full Information'>View Full profile</a></h4></div>"},
            
{marker_id 313,
            
latitude:  52.878997,
            
longitude:  -1.078088,
            
draggablefalse,
            
icon"cat-43.png",
            
infow:"<div class='infowindow'><a href='/network/profile/313' title='View Full Information' class='image'><img src='/images/made/images/avatars/uploads/avatar_313_50_50_c1.png'></a><h3><a href='/network/profile/313'>Dr Robert Ward</a></h3><h4>British Geological Survey<h4><a href='/network/profile/313' title='View Full Information'>View Full profile</a></h4></div>"},
            
{marker_id 340,
            
latitude:  53.808478,
            
longitude:  -1.552792,
            
draggablefalse,
            
icon"cat-35.png",
            
infow:"<div class='infowindow'><a href='/network/profile/340' title='View Full Information' class='image'><img src='/images/made/images/avatars/uploads/avatar_340_50_50_c1.jpg'></a><h3><a href='/network/profile/340'>Professor Joseph Holden</a></h3><h4>University of Leeds<h4><a href='/network/profile/340' title='View Full Information'>View Full profile</a></h4></div>"},
            
],
            
navigationControltrue,
            
scaleControltrue,
            
streetViewControlfalse,
            
scrollwheel:false,
            
disableDoubleClickZoom:true
            }
);
        
});
        function 
myclick(i{
            google
.maps.event.trigger($.mxgoogleMaps.marker[i]"click");
        

How to pass map object to marker class and make marker cluster to work.

Thanks

     
Avatar
RankRankRankRank

Total Posts: 653

Joined 2010-07-13

PM

Hello,
check this example.

Questions welcome!

     

Signature

Rank

Total Posts: 3

Joined 2012-01-27

PM

thanks for replay, yes this work, but I suppose to use it with this addon. Maybe question is how to get map obj from the mxgoogleMaps so I can pass it to cluster function like:

new MarkerClusterer(mxmapObj,$.mxgoogleMaps.marker

Thanks

     
Avatar
RankRankRankRank

Total Posts: 653

Joined 2010-07-13

PM

This example build with my add-on too. Is only question - use mxgooglemap.js library(which was build actually for backend support) or
not. It’s not enough to receive map obj id - you need first create markerCluster, then add markers on the map with using markerCluster. Actually markerCluster is delete marker array after ini. $.mxgoogleMaps do map and in the same moment create markers. I just modify littel bit example and include new marker list.

Send me your full template text in zip to PM. I will look.

p.s.
in current version u can detect id with simple block:

for ( var g_id in $.mxgoogleMaps.gMap)  {
      map_id 
g_id;
}
// $.mxgoogleMaps.gMap[map_id] <- your map 

 

     

Signature

Rank

Total Posts: 3

Joined 2012-01-27

PM

All works great!
Many thanks for your support