views:

32

answers:

1

I have a bit of a puzzle on my hands. I'm Using Google Maps v3 and MarkerClusterer v3. When I load my page, the map appears, the points are all there, but nothing is clustered.

If I go to the firebug console and do:

markerCluster = new MarkerClusterer(map, markers);

Suddenly clustering works.

Weirdly, If I put an alert between the map instantiation and the markerclusterer instantiation, again clustering suddenly works. Here is the end of my $(document).ready function:

    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    markerCluster = new MarkerClusterer(map, markers);

and all it takes to make the clustering work is:

    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    alert("test");
    markerCluster = new MarkerClusterer(map, markers);

What am I missing here? Do I need to refresh the map somehow? Is that what is happening with the alert box?

If you need more code drop me a comment.

A: 

Have you checked out this thread on MarkerClusterer v3? It's got a few links to some handy resources, namely code examples and reference docs.

Check the examples and make sure they're working OK in your testing browser (you never know, could be an issue with MC).

TheDeadMedic
Yeah, I took a look at that thread. The examples all work fine and according to the docs I am doing the right thing. I must be doing the right thing because it works sometimes. If only I can get it to work all the time...
Mike Williamson
Definitely using MarkerClusterer v3 in your project? Could you post a little more code, see if we can fix this thang!
TheDeadMedic