[OpenLayers-Users] problem with QUERY_LAYERS

vrbikdan vrbikdan at gmail.com
Sun May 1 11:52:21 EDT 2011


Hi,
I'm trying to set WMSGetFeatureInfo in my map, but I'm not succesfull. I
need insert in QUERY_LAYERS in vendorParams names of layers, which are
visible. So I wrote function to insert into variable this names and this
variable I placed into QUERY_LAYERS. But if I click on some point in my map
it writes: "No QUERY_LAYERS has been requested, or no queriable layer in the
request anyways" Can you help me with it? I thing that everything should be
ok. Here is part of my code.

function informace()
  {
  zapnuteVrstv = "";
  x = document.getElementsByName("poi");
  for(a=0;a<x.length;a++) {if(x[a].checked == true) zapnuteVrstv +=
x[a].value+", ";}
  zapnuteVrstv = (zapnuteVrstv.length >
2)?zapnuteVrstv.substr(0,(zapnuteVrstv.length - 2)):"nic";
  alert(zapnuteVrstv);  
  }


infoControls = {
            click: new OpenLayers.Control.WMSGetFeatureInfo({
                url: 'http://localhost:8080/geoserver/wms', 
                title: 'Identify features by clicking',
                layers:[body2, body3, body4, body5, body6, body7],
		vendorParams: {"QUERY_LAYERS": [zapnuteVrstv]},
		})
		};
		
		for (var i in infoControls) { 
            infoControls[i].events.register("getfeatureinfo", this,
showInfo);
            map.addControl(infoControls[i]); 
};
        
function showInfo(evt) {
	$('infoDiv').innerHTML = evt.text;
};

In "zapnuteVrstv" it should be names of visible layers so in QUERY_LAYERS
should be written: 'dp:body2', 'dp:body7' and so on.

Thanks for help,
Dan--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/problem-with-QUERY-LAYERS-tp6321536p6321536.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list