Using gmaps.js and having an issue with marker clustering... it works perfectly fine although in my case I may have markers with the exact same location (lat/lng).
What happens is when you zoom to the highest level the cluster disappears and there are no markers shown at all (I thought they would be layered over each other so at lease one is viewable, but that is not the case for me). I have found some solutions on here which change the lat/lng values slightly so each marker has a different location, but in reality like 100 meters difference or something. I think this would work find in my situation, but I do not know how to implement these solutions since I am using gmaps.js.
Current working code, but the problem mentioned above :
response.results in an array of my location data retrieve with ajax...
//create the map
map = new GMaps({
el: '#map_canvas_main',
lat: response.results[0].lat,
lng: response.results[0].lng,
panControl : false,
markerClusterer: function(map) {
return new MarkerClusterer(map);
}
});
//loop through array
for(var i = 0; i < response.results.length; i++)
{
//add marker
map.addMarker({
lat: response.results[i].lat,
lng: response.results[i].lng,
title: response.results[i].ip_address,
infoWindow: {
content: '<p>'+response.results[i].ip_address+'</p>'
}
});
}
EDIT :
I added a fiddle mimicking multiple markers at the same location. Strangely in the fiddle the 'cluster marker' does not disappear yet in my site it does. What happens on my site is you can zoom in on the marker any way you want... when you reach the highest zoom level and click on it... it disappears. You need to zoom out or pan around for the image to come back. This does not happen in the fiddle though.
Regardless of that though - I still need a method in which to show the information for all the markers in the same location... most of the solution I found here on SO change the lat/lng ever so slightly to avoid this...