views:

300

answers:

1

Hi there,

I am having problems using the MarkerManager. Somehow Markers added with the MarkerManager do not show up, though i do mgr.refresh(); It works when i use basic map.addOverlay(marker); but not when using mgr.addMarker(marker);. Weird. Hope someone here can help.

Here's the relevant code:

  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map"));
    bounds = new GLatLngBounds();
    map.setCenter(new GLatLng(48.25, 11.00), 4);

    mgr = new MarkerManager(map, mgr_options);
    markers = createSpotMarkers(spots); // parsing spots, extending bounds, creating Array of GMarkers etc, pretty basic and seems not be relevant.
    mgr.addMarkers(markers); // does not work
    map.addOverlay(markers[0]); // works
    mgr.addMarker(markers[0]); // does not work either 

    map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)-1);
    mgr.refresh();
  } 
+2  A: 

It looks like the API for MarkerManager expects 3 arguments to addMarkers, of which the 3rd seems to be optional. The second, however, doesn't. If the API doesn't help, then a blog post showing example usage might. Good luck!

Tony Miller
Thanks! Didn't realize that the second argument is mandatory.
Nils Riedemann