I have some WMS layers with attributes and I want to show some info when I click on some of them.

Currently I'm using:

info = new OpenLayers.Control.WMSGetFeatureInfo({url: 'http://localhost:8080/geoserver/SIMI/wms', 
                title: 'Identify features by clicking',
                queryVisible: true,
                eventListeners: {
                    getfeatureinfo: function(event) {
                        map.addPopup(new OpenLayers.Popup.FramedCloud(


Inside the init() function and works perfectly. When I click something it shows the info.

But I want the popups to be opened as default, when I load the page containing the map. Is this possible? Also, I'd like to be able to open the popup only for a layer (I'm using a layer group and currently using content.ftl to filter out stuff but it's not viable since it still opens a popup with no content).

1 Answer 1


As you are requesting these popups from a WMS layer (an image) OpenLayers does not know what features maybe available to click on.

When you click on the map currently OpenLayers has to call the server with this x, y (pixel coordinates in the image) to see if a feature exists at this point. If a feature does exist it renders the returned information into a popup.

You maybe better using a vector layer or if you must use WFS you could create a function which calls the GetFeatureInfo at a known set of points on the map which would programmatically render the popups. You will then need to stop this control from closing other popups when showing the new ones.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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