> I believe I have an array in my javascript code that fetches the data
> from the XML file and displays the markers on my map.
>
> However, for the life of me I cannot get the cluster maker to work.
Looking at Martin's example -
for (var i=0; i<json.length; i++) {
marker=newMarker( ... whatever ... );
markersArray.push(marker); <<<< Here's where each marker
gets stored
} <<<< This is the end of the loop
Then after the loop he goes on with
var cluster=new ClusterMarker(map, { markers:markersArray } );
Note that marker are NOT addOverlay'd to the map, that's the
clusterers job.
So, comparing to yours ... your loop is within function
drawLocations ...
for(var i=0;i<locs.length;i++) {
...
var marker = new GMarker(point,{icon:icon,title:name}); <<
making a marker
...
this.map.addOverlay(marker); << putting it on the map
...
GoogleMap.branches.push(marker); << storing each marker
} << end of your loop.
So, your map is 'GoogleMap'. Your markers are stored in
'GoogleMap.branches'. You need to figure out how NOT to add the
markers to your map yourself. You need to find the end of your loop.
You need to create your clusterer after the end of your loop, and you
need to tell it which map object to use and which array of markers to
use.
Once the clusterer is set up, give it a kick to make it plot the
markers using .fitMapToMarkers()
You still have an unrelated error in your script, check the browser
error messages
--
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.