Hi, It seems, that your loop creates the window for your first queryable layer and then the queryresult of your next queryable layers use the same window and overwrite the contents of the window "getfeatureinfo". The last wins.
If you change the window name to "getfeatureinfo" + i, then you should get one window for every query. A second approach is to collect the visibible layers and do only one getfeatureinfo request with this layerlist. Then you get back from MapServer one result html for all the queried layers. Arnd -----Ursprüngliche Nachricht----- Von: users-boun...@openlayers.org [mailto:users-boun...@openlayers.org] Im Auftrag von Aypes2 Gesendet: Freitag, 13. November 2009 08:24 An: users@openlayers.org Betreff: [OpenLayers-Users] Query problem Dear all, I just got a query problem. I have several overlays, and I want them to be queryable when they are turned on (visible) only. But I found if I turn on two or more overlays, only 1 layer can be queried and other visible overlays give no result (empty template in mapfile). Here is my code: map.events.register('click', map, function (e) { var oplayers = new Array( alayer.visibility, blayer.visibility, clayer.visibility, dlayer.visibility, elayer.visibility, flayer.visibility); var mslayers = new Array("a","b","c","d","e","f"); var i=0; for (i=0; i < 7; i++) { if ( oplayers[i] == true ) { var url = "http://localhost/cgi-bin/mapserv.exe" + "?map=c:/ms4w/Apache/htdocs/mapfile.map" + "&REQUEST=GetFeatureInfo" + "&VERSION=1.1.1" + "&EXCEPTIONS=application/vnd.ogc.se_xml" + "&BBOX=" + map.getExtent().toBBOX() + "&X=" + e.xy.x + "&Y=" + e.xy.y + "&INFO_FORMAT=text/html" + "&QUERY_LAYERS=" + mslayers[i] + "&LAYERS=" + mslayers[i] + "&FEATURE_COUNT=1" + "&SRS=EPSG:4269" + "&STYLES=" + "&WIDTH=" + map.size.w + "&HEIGHT=" + map.size.h; window.open(url, "getfeatureinfo", "location=0,status=0,scrollbars=1,width=600,height=400" ); }; }; }); alayer,blayer,clayer,dlayer,elayer,flayer are names of layers defined in html. (var alayer = ......) a,b,c,d,e,f are the layer names of the mapfiles. The only querable layer is the 'highest' one. For example, if I turn on alayer and blayer, blayer can be queried but alayer cannot. If alayer, blayer and flayer are on, only flayer can be queried. I find that the layer with higher variable i ([ oplayer[i] ]) would be queried only. I know there is a function called WMSfeatureGetinfo but I don't know how to use it. I just know it has queryVisible which can filter the hidden layers, but error 'permission denied' always comes out when I click on the query layer. I prefer my method, and I think the logic of my code is okay but something is wrong. Can anyone get idea about that? Regards, Aypes2 -- View this message in context: http://n2.nabble.com/Query-problem-tp3997793p3997793.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users