My situation is that I'm dealing with a *lot* of markers and
MarkerManager.js was not speedy enough. Using kml files is much more
efficient. In the code below you'll see that different kml files are
loaded according to the map's zoom level. Everything works great.
However, I can't remove the kml layer once it's been applied, which is
necessary to duplicate MarkerManager's functionality.
Here's the reference page for geoXML3:
http://code.google.com/p/geoxml3/wiki/ParserReference
Thanks a lot for the help.
function getSystemFile() {
switch (myMap.getZoom()) {
case (MIN_ZOOM + 1):
system_file = '3025-2.xml';
break;
case (MIN_ZOOM + 2):
system_file = '3025-3.xml';
break;
case (MIN_ZOOM + 3):
system_file = '3025-4.xml';
break;
default:
system_file = '3025-1.xml';
}
return system_file;
}
function initialize() {
...yada yada...
var myParser = new geoXML3.parser({
createMarker: addMyMarker,
map: myMap,
processStyles: true,
singleInfoWindow: true,
zoom: false
});
myParser.parse(getSystemFile());
google.maps.event.addListener(myMap, 'zoom_changed', function() {
myParser.parse(getSystemFile());
});
function addMyMarker(placemark) {
myParser.createMarker(placemark);