Hi,
I have a page that i'm trying to code which loads a bunch of addresses
from the database into a form field (seperator for later split and
loop through to create the markers), and displays those addresses into
markers on the map.
However, due to the nature of the application's back-end data, there
can be at one point a little over 2000 markers that are so close to
each other that it's a big mess on the map. So i looked into the
MarkerClusterer.js option, which sounds great! However, i'm having a
little bit of a problem trying to implement it. I am looping through
the array of addresses and pushing a new marker to my array every
iteration, and then once all of the markers are in the array, i am
declaring my MarkerClusterer object.
Here's my problem: my map shows nothing... is there anything special i
am missing/should be doing?
here's a summary of the code i have... if from this you can't see the
problem, let me know and i will post the entire script:
<code>
var map;
var geocoder;
var mymarkers=[];
var cluster;
function initialize()
{
if (GBrowserIsCompatible())
{
map = new GMap2(document.getElementById("map_canvas"));
geocoder = new GClientGeocoder();
map.setCenter(new GLatLng(51.253775, -85.3232139), 13);
map.setUIToDefault();
map.setZoom(<%=currzoom%>);
geo();
cluster = new MarkerClusterer(map,mymarkers);
}
else
{
alert("Sorry, your browser is incompatible with google maps
V2");
}
}
//NOTE: this is not the full script, only a summary/shortened version
function geo()
{
var addresses=document.getElementById("addresses").value
var x=addresses.split("#$%")
var i;
var ll;
for(i=0;i<=x.length;i++)
{
//shortened version of this statement
ll=geocoder.getLatLang(x(i),function(point){
var marker = new GMarker(point);
mymarkers.push(marker);
});
}
return;
}
</code>
any help would be greatly appreciated on this.
thanks!
Matt
--
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.