1

I'm still learning OpenLayers. I found this weird issue in my OpenLayers map. I create FramedCloud popups and add them to each features.

popup = new OpenLayers.Popup.FramedCloud("popup",
    OpenLayers.LonLat.fromString(parsedFeature.geometry.toShortString()),
    null,
    "<div style='font-size:.8em'>date: " + someDate + "<br>longitude: " + data.lon + "<br>latitude: " + data.lat + "</div>",
    null,
    false
);

But I don't add them until it gets to certain zoom level. Then I add the popups to the map with the following code

olMap.events.register('zoomend', olMap, function () {
    var zoom = olMap.getZoom();
    var popup;
    if (zoom > 11) {
        for (i = 0; i < dm.currentLocationsVector.features.length; i++) {
            popup = dm.currentLocationsVector.features[i].popup;
            if (!popup.map) {
                olMap.addPopup(popup);
            }
        }
    } else if (zoom < 12) {
        for (i = 0; i < vector.features.length; i++) {
            popup = vector.features[i].popup;
            if (popup.map) {
                olMap.removePopup(popup);
            }
        }
    }
});

Actually it works good until zoom 17 then when the map zoom level gets 18 the map breaks.

enter image description here

It looks like the popups and the map get messed in some way. I don't think I have problem in creating popups.Thought it might some bug in OpenLayers.

  • Can you post a reproducible example, maybe on jsfiddle? – Devdatta Tengshe Sep 12 '13 at 2:59
  • @DevdattaTengshe Thanks for your interest, I'll do so as soon as I can. – Eugene Yu Sep 12 '13 at 4:09