Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some problem with the popup code in OpenLayers, using Text layer (yes i know there already GML layer out there with text format, but i need to modify existing code), the problem was popup not removed when i open new popup (by clicking another marker)

OpenLayers.Feature.prototype.popupClass = OpenLayers.Popup.FramedCloud;

        OpenLayers.Layer.Text.prototype.markerClick = function(evt) {
            var sameMarkerClicked = (this == this.layer.selectedFeature);
            if (this.popup) {
            } else {
            this.layer.selectedFeature = (!sameMarkerClicked) ? this :

code by Christopher Schmidt :

share|improve this question

I've successfully used the functions from this post:

share|improve this answer

As far as I know, in an OpenLayers map viewer showing a new popup window does not imply that other already present popup windows will automatically be closed (at least when I was working with OpenLayers, more that 1 year ago).

You can get such behaviour by (a) having a list of references to already open popup windows, (b) close all popups present in this list when opening a new popup window and (c) updating the list.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.