I want to show total number of members inside Cluster Group.
Currently it shows Total number of Clusters inside a group.
For example, this example shows 15
inside a circle. Whereas i want to show the total sum
of 3rd parameter
of this array addressPoints
which is a total of 14096
inside the circle.
How can we do that?
var addressPoints = [
[-37.8839, 175.3745188667, "571"],
[-37.8869090667, 175.3657417333, "486"],
[-37.8894207167, 175.4015351167, "807"],
[-37.8927369333, 175.4087452333, "899"],
[-37.90585105, 175.4453463833, "1273"],
[-37.9064188833, 175.4441556833, "1258"],
[-37.90584715, 175.4463564333, "1279"],
[-37.9033391333, 175.4244005667, "1078"],
[-37.9061991333, 175.4492620333, "1309"],
[-37.9058955167, 175.4445613167, "1261"],
[-37.88888045, 175.39146475, "734"],
[-37.8950811333, 175.41079175, "928"],
[-37.88909235, 175.3922956333, "740"],
[-37.8889259667, 175.3938591667, "759"],
[-37.8876576333, 175.3859563833, "687"],
];
var tiles = L.tileLayer('//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© <a href="//openstreetmap.org/copyright">OpenStreetMap</a> contributors, Points © 2012 LINZ'
});
var map = L.map('map', {
center: L.latLng(-36.848461, 174.763336),
zoom: 5,
layers: [tiles]
});
var mcg = L.markerClusterGroup({
chunkedLoading: true,
//singleMarkerMode: true,
spiderfyOnMaxZoom: false
});
for (var i = 0; i < addressPoints.length; i++) {
var a = addressPoints[i];
var title = a[2];
var marker = L.marker(new L.LatLng(a[0], a[1]), { title: title });
marker.bindPopup(title);
mcg.addLayer(marker);
}
map.addLayer(mcg);
Here's JSFiddle