I'm trying to use this tutorial (https://www.mapbox.com/mapbox.js/example/v1.0.0/markercluster-with-mapbox-data/) to create marker clusters to style a Mapbox featureLayer containing my data. This code works to display my data:
var featureLayer = L.mapbox.featureLayer(rodents1,{
pointToLayer: function (feature,latlng){
return L.circleMarker(latlng,markerStyle);
},
}).addTo(map);
But when I try to rework my code according to the instructions, my data goes missing from my map. Here is the code according to the instructions:
// Since featureLayer is an asynchronous method, we use the `.on('ready'`
// call to only use its marker data once we know it is actually loaded.
L.mapbox.featureLayer('rodents1').on('ready', function(e) {
// The clusterGroup gets each marker in the group added to it
// once loaded, and then is added to the map
var clusterGroup = new L.MarkerClusterGroup();
e.target.eachLayer(function(layer) {
clusterGroup.addLayer(layer);
});
map.addLayer(clusterGroup);
I've included links to the Leaflet/markercluster files in the head of my html file.
Am I missing something?