diff --git a/lib/OpenLayers/Control/WMSGetFeatureInfo.js b/lib/OpenLayers/Control/WMSGetFeatureInfo.js index 43f2f3846d..2c6b239c66 100644 --- a/lib/OpenLayers/Control/WMSGetFeatureInfo.js +++ b/lib/OpenLayers/Control/WMSGetFeatureInfo.js @@ -350,6 +350,7 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { height: this.map.getSize().h, width: this.map.getSize().w, format: format, + viewparams: firstLayer.params.VIEWPARAMS, info_format: firstLayer.params.INFO_FORMAT || this.infoFormat }, (parseFloat(firstLayer.params.VERSION) >= 1.3) ? { @@ -363,6 +364,23 @@ OpenLayers.Control.WMSGetFeatureInfo = OpenLayers.Class(OpenLayers.Control, { y: parseInt(clickPosition.y) } ); + + var len = Object.keys(firstLayer.params).length; + for (var i =0; i < len; i++) { + var otherKey = Object.keys(firstLayer.params)[i]; + if ( !( otherKey == 'LAYERS' || + otherKey == 'TRANSPARENT' || + otherKey == 'STYLES' || + otherKey == 'SERVICE' || + otherKey == 'VERSION' || + otherKey == 'REQUEST' || + otherKey == 'FORMAT' || + otherKey == 'SRS') ) { + + params[otherKey] = firstLayer.params[otherKey]; + } + } + if (layerNames.length != 0) { params = OpenLayers.Util.extend({ layers: layerNames,