I am using the WMSGetFeatureInfo
control to retrieve feature attributes from geoserver and display in popups.
I've setup the proxyhost at localhost and the popup is working fine now. I am using eventListeners
.
After it executes the last line, map.addPopup(popup)
, the layout of the html file changes as shown in the attached images.
The codes is as below:
shelter_info = new OpenLayers.Control.WMSGetFeatureInfo ({
url:"http://130.95.44.145:8080/geoserver/Bushfire_Com_Study/wms",
title: 'Identify features by clicking',
layers:[evacuation_center],
queryVisible: true,
hover: true,
eventListeners:{
getfeatureinfo: function(event){
//only display popup when selected the WMS object
if (event.text.indexOf("<table class=\"featureInfo\">") != -1) {
var popup = new OpenLayers.Popup.FramedCloud(
"shelter_popup",
map.getLonLatFromPixel(event.xy),
null,
event.text,
null,
true,
null
);
popup.autoSize = true;
popup.minSize = new OpenLayers.Size(180,180);
map.addPopup(popup);
}
}
}
});
Before adding popups:
After adding popups: