MarkerClusterer Plus and Cluster sorting

92 views
Skip to first unread message

Coen de Jong

unread,
Jan 30, 2012, 9:51:57 AM1/30/12
to google-map...@googlegroups.com
Is there a way to ensure the Clusters given by getClusters() function in the Clusterer class always gives the Clusters sorted by order of the markers that it contains and the order they were placed on the map? I have a website where I need to draw arrows that go from one marker to another to indicate a travel path. However, with the clusterer the order of the clusters in getClusters() are different every time. So my arrow drawing function draws arrows in the wrong sequence sometimes when you have to redraw because markers/clusters changed.

Here is a test website with what I mean: http://labs.shifthappens.nl/vagabond/pilot . At first load everything seems OK, the arrows are drawn from marker A to marker J without strange things. But as soon as you start panning around or zoom in/out a couple of times, the arrows change and go from A -> B -> E -> J or any other combination.

I understand that the sequence normally doesn't matter that much, but in my case it does. If I can't trust the getClusters function I have to resort to sorting the clusters manually after getting them. This is not only more work for me, it also slows down the map movements.

Someone got a solution for this?
Reply all
Reply to author
Forward
0 new messages