I am working on an angular 16 project.
this.markerCluster = new MarkerClusterer({map:this.map, markers: this.markers, renderer, onClusterClick:this.listCluster.bind(this), });
listCluster(cluster){ let markers = cluster.getMarkersList(); console.log(markers); }
I need to get the list of markers present in a specific cluster. I've tried getMarkers() and getMarkersList() but neither works.
You are trying to use a method to get markers in a cluster, but the method you need depends on the specific version of the
MarkerClusterer
library you are using.In newer versions of the @google/markerclusterer library (since v3), you can use the
getMarkers()
method to retrieve markers within a cluster: