Question regarding Marker Cluster

85 views
Skip to first unread message

Leaflet_Mapbox_newbie

unread,
Apr 16, 2014, 3:15:35 PM4/16/14
to leafl...@googlegroups.com
Hi,

I am using the Marker Cluster plugin and am having problems on displaying markers which are at the exact same location. In the example shown at http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.388.html , i see that for markers on exact same location upon clicking there is a spider effect and the markers arrange in a circle and user can click each one. For some reason it is not happening on mine, it only shows one marker for all features for that location. I cannot figure out what i am doing wrong. My code is below:



                                                       var geoJson = jQuery.parseJSON(response);

var map = L.mapbox.map('map', 'kavinmehta.map-bhrg0jfe',{tileLayer: {detectRetina: true}}).setView([CENTERLAT, CENTERLONG], 14).addControl(L.mapbox.geocoderControl('kavinmehta.map-bhrg0jfe'));

var geojson = L.geoJson(geoJson, {

onEachFeature: function (feature, layer) {
var popupContent ='';

if (feature.properties && feature.properties.description) {
if (feature.properties.title) {
popupContent += "<b><u>" + feature.properties.title+ "</u></b></br>";
}
popupContent+=feature.properties.description; 
layer.bindPopup(popupContent,{
closeButton: false
});
}
}
});


var markers = L.markerClusterGroup();
markers.addLayer(geojson);
map.addLayer(markers);


Leaflet_Mapbox_newbie

unread,
May 5, 2014, 12:29:31 AM5/5/14
to leafl...@googlegroups.com
Some good guy over at github answered my question....the solution is to add the maxZoom attribute to your map. i had to play around with the exact value but 16 worked for me.
Reply all
Reply to author
Forward
0 new messages