I am using the GeoExt example and this is the js code and trying to get rid of the multiple lat and lon that get added into the PopUp on multiple clicks.

Not sure which is the code that I need to comment out? I thought that removing,

this.handlerOptions = OpenLayers.Util.extend(
            options && options.handlerOptions || {}, 

Would do the job but it seems that is not right as I am still getting the multiple popups and commenting out that code made no difference. Not sure what that code was for?


Try to modify code of your Click control:

var control = new OpenLayers.Control.Click({
    trigger: function(evt) {
        var loc = mapPanel.map.getLonLatFromViewPortPx(evt.xy);
        if (popup) popup.close();
  • thanks a lot that works beautifully. Another problem is that in the example that i have posted in the question, the popup moves along with the location, in my case it continues to be static. I think it because of the difference in the projection, but do not know how should I change the projection? – Sam007 Aug 1 '12 at 22:13
  • I did add location: loc.xy to the popup = new GeoExt.Popup({}) but still it made no difference. – Sam007 Aug 1 '12 at 22:16
  • Could you create new question and share your code or live demo link? – drnextgis Aug 1 '12 at 22:47
  • here is the question and the link to my app gis.stackexchange.com/questions/30767/… – Sam007 Aug 2 '12 at 2:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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