hi.. i really need help, my cluster map using ef Poskanzer's Clusterer
doesnt work... here the code :
call this :
<SCRIPT src="js/Clusterer2.js" type="text/javascript"></SCRIPT>
code :
function load() {
if (GBrowserIsCompatible()) {
var iconBlue = new GIcon();
iconBlue.image = 'http://labs.google.com/ridefinder/images/
mm_20_blue.png';
iconBlue.shadow = 'http://labs.google.com/ridefinder/images/
mm_20_shadow.png';
iconBlue.iconSize = new GSize(12, 20);
iconBlue.shadowSize = new GSize(22, 20);
iconBlue.iconAnchor = new GPoint(6, 20);
iconBlue.infoWindowAnchor = new GPoint(5, 1);
var iconRed = new GIcon();
iconRed.image = 'http://labs.google.com/ridefinder/images/
mm_20_red.png';
iconRed.shadow = 'http://labs.google.com/ridefinder/images/
mm_20_shadow.png';
iconRed.iconSize = new GSize(12, 20);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);
var clusterIcon = new GIcon();
clusterIcon.image = '/blue_large.png';
clusterIcon.shadow = '/shadow_large.png';
clusterIcon.iconSize = new GSize( 30, 51 );
clusterIcon.shadowSize = new GSize( 56, 51 );
clusterIcon.iconAnchor = new GPoint( 13, 34 );
clusterIcon.infoWindowAnchor = new GPoint( 13, 3 );
clusterIcon.infoShadowAnchor = new GPoint( 27, 37 );
var customIcons = [];
customIcons["restaurant"] = iconBlue;
customIcons["bar"] = iconRed;
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(47.614495, -122.341861), 8);
var clusterer = new Clusterer(map);
// set the clusterer parameters if you dont like the defaults
/*clusterer.icon = clusterIcon;
clusterer.maxVisibleMarkers = 5;
clusterer.gridSize = 5;
clusterer.minMarkersPerClusterer = 5;
clusterer.maxLinesPerInfoBox = 5;*/
//var mgr = new MarkerManager(map);
// Create marker array
//var markersa = [];
GDownloadUrl("phpsqlajax_genxml.php", function(data) {
// Create a new instance of the MarkerManager
var xml = GXml.parse(data);
var markers =
xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var point = new
GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(point, name, address, type);
//map.addOverlay(marker);
//markersa.push(marker);
clusterer.AddMarker(marker,name);
}
});
//mgr.addMarkers(markersa);
// Refresh the MarkerManager to make the markers appear on the map
//mgr.refresh();
}
}
function createMarker(point, name, address, type) {
var marker = new GMarker(point, customIcons[type]);
var html = "<b>" + name + "</b> <br/>" + address;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
please help me, what is the problem...
thx..
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.