You are here: Home → Forum Home → Free add-ons → Modules → Thread
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,
draggable: false,
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,
draggable: false,
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,
draggable: false,
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>"},
],
navigationControl: true,
scaleControl: true,
streetViewControl: false,
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
Hello,
check this example.
Questions welcome!
my EE1 addons | @eecms @max_lazar
Like my addons? Buy me a coffee ![]()
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
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
my EE1 addons | @eecms @max_lazar
Like my addons? Buy me a coffee ![]()
All works great!
Many thanks for your support