[OpenLayers-Users] WMSgetFeatureInfo doesn't work correctly

vrbikdan vrbikdan at gmail.com
Sat Mar 26 09:21:39 EDT 2011


Hi,
I have problem with getFeatureInfo. When I click somewhere in my map, it
will write information from all layers, but I need to see information only
from visible layers. I set queryVisible: true; but it doesn't work. Can you
anyone help me? Te code I use is below.

Thanks, Dan

		infoControls = {
            click: new OpenLayers.Control.WMSGetFeatureInfo({
                url: 'http://localhost:8080/geoserver/wms', 
                title: 'Identify features by clicking',
                layers: [body2, body3, body4, body5, body6, body7],
				queryVisible: true
            })
		};
		
		for (var i in infoControls) { 
            infoControls[i].events.register("getfeatureinfo", this,
showInfo);
            map.addControl(infoControls[i]); 
        };
		
		
		infoControls.click.activate();
        
		
		function showInfo(evt) {
        if (evt.features && evt.features.length) {
             highlightLayer.destroyFeatures();
             highlightLayer.addFeatures(evt.features);
             highlightLayer.redraw();
        } else {
            $('infoDiv').innerHTML = evt.text;
        }
		};

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/WMSgetFeatureInfo-doesn-t-work-correctly-tp6210474p6210474.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list