GetFeauture Pop-up appear on all layers independent if the are selected or not!!

المشرف العام

Administrator
طاقم الإدارة
I do have an issue with getFeatureInfo. It works on all layers independent of their selection or not.

I used the following code to getFeatureInfo from a layer.

function myGetFeature(map,mylayer) { // support GetFeatureInfo var layerIndex = map.getLayerIndex(mylayer); map.events.register('click', map, function (e) { var params = { REQUEST: "GetFeatureInfo", EXCEPTIONS: "application/vnd.ogc.se_xml", BBOX: map.getExtent().toBBOX(), SERVICE: "WMS", INFO_FORMAT: 'text/html',//'text/plain', //INFO_FORMAT: 'application/json', QUERY_LAYERS: map.layers[layerIndex].params.LAYERS, FEATURE_COUNT: 150, "Layers": mylayer.params.LAYERS, WIDTH: map.size.w, HEIGHT: map.size.h, format: format, styles: map.layers[layerIndex].params.STYLES, srs: map.layers[layerIndex].params.SRS}; // handle the wms 1.3 vs wms 1.1 madness if(map.layers[layerIndex].params.VERSION == "1.3.0") { params.version = "1.3.0"; params.j = parseInt(e.xy.x); params.i = parseInt(e.xy.y); } else { params.version = "1.1.1"; params.x = parseInt(e.xy.x); params.y = parseInt(e.xy.y); } // merge filters if(map.layers[layerIndex].params.CQL_FILTER != null) { alert("CQL"); params.cql_filter = map.layers[layerIndex].params.CQL_FILTER; } if(map.layers[layerIndex].params.FILTER != null) { alert("FILTER"); params.filter = map.layers[layerIndex].params.FILTER; } if(map.layers[layerIndex].params.FEATUREID) { alert("FEATUREID"); params.featureid = map.layers[layerIndex].params.FEATUREID; } OpenLayers.loadURL(geoServer, params, this, setHTML, setHTML); OpenLayers.Event.stop(e); }); }...

myGetFeature(map,layer1);myGetFeature(map,layer2);myGetFeature(map,layer3);The problem is that even in the map with no overlay selected if you click on various locations you get the popup with the data of the layer???



أكثر...
 
أعلى