the clusters returned from @googlemaps/markerclustererplus will also return a cluster for single markers. This allows me to set the clusters outside of google.map.Marker by using React.useState(), check for cluster.getMarkers().length > 1 and if so render a specific custom react component for the cluster icon and another custom react component for when getMarkers().length === 1.
The clusters returned from @googlemaps/markerclusterer will ONLY return clusters where markers.length >= 2. This is the case even though stats will return a cluster count including clusters where markers.length === 1. Also, the protected clusters response from const markerClustererResponse = initialiseMarkerClusterer(map, propertyMarkers) will also include clusters where markers.length === 1.
const renderer = {
render(cluster, stats) {
**console.log(cluster)**; // RETURNS ONLY CLUSTERS WITH MARKERS.LENGTH >= 2.
**console.log(stats)**; // RETURNS stats.cluster NOT CONSISTENT WITH cluster response. It returns clusters where there is only one marker.
return new google.maps.Marker({
....
});
}
}
new MarkerClusterer({map, markers, renderer});
I believe there is some lost behaviour between @googlemaps/markerclustererplus and js-markerclusterer
the clusters returned from @googlemaps/markerclustererplus will also return a cluster for single markers. This allows me to set the clusters outside of google.map.Marker by using React.useState(), check for cluster.getMarkers().length > 1 and if so render a specific custom react component for the cluster icon and another custom react component for when getMarkers().length === 1.
The clusters returned from @googlemaps/markerclusterer will ONLY return clusters where markers.length >= 2. This is the case even though
stats
will return a cluster count including clusters where markers.length === 1. Also, the protected clusters response from const markerClustererResponse = initialiseMarkerClusterer(map, propertyMarkers) will also include clusters where markers.length === 1.@googlemaps/markerclustererplus IMPLEMENTATION
@googlemaps/markerclusterer IMPLEMENTATION