Is it possible to make a cluster based on the distance between each pins?
Example: Pins A, B, C are 50 meters apart. Since B is the middle pin and the distance between A-B and B-C are 50 meters, the 3 pins are considered as one cluster.
I was able only able to cluster pins that are close to each other by setting the max zoom to 16. Here is my code:
var map = L.map( 'map', {
center: [7.2,125.55],
maxZoom: 16,
zoom: 11
});
L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo( map );
var myURL = jQuery( 'script[src$="map.js"]' ).attr( 'src' ).replace( 'map.js', '' );
var myIcon = L.icon({
iconUrl: myURL + 'images/pin24.png',
iconRetinaUrl: myURL + 'images/pin48.png',
iconSize: [29, 24],
iconAnchor: [9, 21],
popupAnchor: [0, -14]
});
var markerClusters = L.markerClusterGroup({
elementsPlacementStrategy: 'original-locations',
showCoverageOnHover: true
});
for ( var i = 0; i < markers.length; ++i ) {
var popup = '<b>Latitude:</b> ' + markers[i].lat + '<br/><b>Longitude:</b> ' + markers[i].lng;
var m = L.marker( [markers[i].lat, markers[i].lng], {icon: myIcon} ).bindPopup( popup );
markerClusters.addLayer( m );
}
map.addLayer( markerClusters );