[OpenLayers-Users] Query problem
Aypes2
apestgas2 at yahoo.com.hk
Fri Nov 13 02:23:56 EST 2009
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.
More information about the Users
mailing list