Hi,
I am trying to work with a WMSGetFeatureInfo example for one of my project. My MapServer (local one) supports WMS too.
I am able to view the Map that consists of different WMS layers, able to add the LayerSwitcher control and can use it.
I have added a WMSGetFeatureInfo control in the map but clicking (single) does not issue any requests or rather it does nothing.
* At the moment I dont have any meaninful template file for querying the layer(s) the map file contains an tmp name in place of Template, is this issue due to that?
I have furnished my code below.
Plz help me with this issue.
<h3>Source Code</h3>
<html>
<head>
<title>MapServer GetFeatureInfo</title>
<link rel="stylesheet" href="OL-2.10/theme/default/style.css" type="text/css" />
<style type="text/css">
.w {
width: 500px;
height: 400px;
}
</style>
<script src="OL-2.10/lib/OpenLayers.js">
</script>
<script>
/*Proxy does not need as I am dealing with the same server*/
//OpenLayers.ProxyHost = "OL-2.10/examples/proxy.cgi?url=";
var map, l = ['ortofoto2009', 'centraline_new', 'cn156', 'cn5', 'cn171'],
                                layers = [], infoControl = null,
                                mpTmp = null,
                                fmt1 = 'image/gif',
                                fmt2 = 'image/png',
                                baseLayerFlag = false;
window.onload = function(){
var bnds = new OpenLayers.Bounds(663000, 5102000, 665000, 5103000),
                                        ms = 'http://localhost:8080/cgi-bin/mapserv.exe',
                                        mpf = 'C:/ms4w/apps/FarSystems.map',
                                        mp = ms + '?map=' + mpf; //I am using it together for now will change later
                                        
map = new OpenLayers.Map('map', {
maxExtent: bnds
});
for (var i = 0; i < l.length; i++) {
                                        //First layer will act as base layer
                                        //console.log(i === 0)
baseLayerFlag = i === 0 ? true : false;
console.log(baseLayerFlag)
                                        //Layer object Initialization
layers.push(new OpenLayers.Layer.WMS(l[i], mp, {
layers: l[i],
buffer: 4,
transparent: 'true',
format: fmt1
}, {
isBaseLayer: baseLayerFlag,
                                                visibility: true
}));                                        
}
map.addLayers(layers);
map.addControl(new OpenLayers.Control.LayerSwitcher());
//Intializing WMSGetFeatureInfo control
infoControl = new OpenLayers.Control.WMSGetFeatureInfo({
url: mp,
title: 'WMS Test',
layers: l,
infoFormat: 'text/html',
queryVisible: true,
id: 'gfi',
maxFeatures: 2,
eventListeners: {
getfeatureinfo: function(e){
console.log(e);
}
}
});
map.addControl(infoControl);
infoControl.activate();
map.zoomToExtent(bnds, true);                                
};
</script>
</head>
<body>
<div id="map" class="w">
</div>
</body>
</html>
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/WMSGetFeatureInfo-control-is-not-firing-tp6085160p6085160.html">WMSGetFeatureInfo control is not firing</a><br/>
Sent from the <a href="http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Users-f1822463.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br/>