Hi All,

I've been struggling with this one for quite some time, so I'm hoping
someone can help me.

Gmap markers aren't refreshing until the map is moved. so every time
you move it, you get the last set of markers displayed.

Using:
listener with a dynamically created xml file.
Markermanager

I am calling mgr.refresh() after each loop

Another issue is that when I see a marker and click on it, if th epage
has to move in order to fit the popup, it pops up real quickly and
then goes away. you then have to click it again and it stays put.

Any ideas?

Heres some of the code, although it may be a little much for the
initial post:

var map = null;
var geocoder = null;
var mgr = null;
var minZoom = 8;
var xmlfile = "./outputxml.aspx";

function initialize() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_canvas"));
    map.enableDoubleClickZoom();
    map.addControl(new GLargeMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(39, -98), 4);
    mgr = new MarkerManager(map);
    geocoder = new GClientGeocoder();
    GEvent.addListener(map, "moveend", function()
{refreshMarkers();mgr.refresh();});
    GEvent.addListener(map, "zoomend", function()
{refreshMarkers();mgr.refresh();});
  }
}

function refreshMarkers() {
      if (map.getZoom() > minZoom) {
        var bounds = map.getBounds();
        var southWest = bounds.getSouthWest();
        var northEast = bounds.getNorthEast();
        var querydata = "lonne=" + northEast.lng() + "&latne=" +
northEast.lat() + "&lonsw=" + southWest.lng() + "&latsw=" +
southWest.lat() + "&structuretype=" +
        GDownloadUrl(xmlfile + "?type=moveend&" + querydata ,
function(data) {
          var xml = GXml.parse(data);
          var markers =
xml.documentElement.getElementsByTagName("marker");
          var markerBatch = [];
          for (var i = 0; i < markers.length; i++) {
            markerBatch.push(createMarker(markers[i]));
            var curMarker = markers[i];
         }
          mgr.addMarkers(markerBatch, minZoom);
         document.getElementById("TowerDataArea").innerHTML = rowData
+ '</table>';
         document.getElementById("csvlink").href = "getCSV.aspx?" +
querydata;
        });
     }
     mgr.refresh();
}

function createMarker(curMarker) {
    var latlng = new
GLatLng(parseFloat(curMarker.getAttribute("lat")),
parseFloat(curMarker.getAttribute("lng")));
    var marker = new GMarker(latlng, { icon: getCustomIcon() });
    GEvent.addListener(marker, "click", function()
var markerinfo = "stuff"
{marker.openInfoWindowHtml(markerinfo);});
    return marker;
}


Thanks so much for any help!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to