On Jul 21, 8:52 am, jacksplatt11 <[email protected]> wrote: > Hi, I'm just after some help with marker clusterer if anyone is > familiar with it. My site > ishttp://homepage.cs.latrobe.edu.au/tescoberg/maps/trial.html. > I know I only have a few markers on it at the moment, but in future > their will be more so don't worry about that too much. The problem is, > I cant seem to get marker clusterer to work. I have this in the head > after the google maps api key/script part: > <script type="text/javascript" src="markerclusterer.js"></script> > Then in the body, after all the markers have been read from file and > added to an array: > var markerCluster = new MarkerClusterer(map, gmarkers); > I have this, just for testing, which should return 8, but it's > returning 0, meaning the markers aren't getting added? > alert(markerCluster.getTotalMarkers()); > Any help would be greatly appreciated
GXmlHttp is asynchronous. When you do: var markerCluster = new MarkerClusterer(map, gmarkers); the gmarkers array is empty. Sometime later the data arrives and is added to the array, but by then it is too late. from Mike Williams' tutorial: Part 2 Asynchronous I/O http://econym.org.uk/gmap/async.htm Put the statement above inside the call back function after the loop exits (when the data is available). -- Larry --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
