gmap3 / google map. Is there a way to detect if a marker is within a cluster or clustered?
-
04-03-2021 - |
Question
I am using the gmap3 ajquery plugin (for google maps v3) to cluster markers on a google map and need to get a list of which markers are within a cluster.
I am struggling to think what else I can tell you about my issue.
The only potential solution I can think of is to loop through all markers and compare their lat / long positions, but that seems so in efficient.
Solution
I've changed to jquery UI map
It has a function which fetches only markers and not clusters.
$('#map').gmap('findMarker', '', '', false, function(marker, found) {
//do stuff with marker here
});
By removing and re-adding the markers and then redrawing the clusters I have the solution I was after.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow