<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Thanks for the replies.&nbsp; I'll work on it.<br><br>Regards, <br><br>Iván<br><br><br><br><br><br><br><br><br><br>&gt; Are you using firebug ?  If not, you should.  It's a great javascript <br>&gt; tool.  Put breakpoints where needed and you'll see the functions and <br>&gt; object properties available for what you need.<br>&gt; <br>&gt;   Since you're starting with OpenLayers, you should try to make the <br>&gt; query work for one layer only ( do no loop in the map layers yet ).<br>&gt; <br>&gt;   It could looks like this :<br>&gt; <br>&gt;         if(!event)<br>&gt;             return;<br>&gt; <br>&gt;         if(!layer.getVisibility() || !layer.inRange)<br>&gt;             return;<br>&gt; <br>&gt;          // carry on with your query<br>&gt; <br>&gt; Regards,<br>&gt; <br>&gt; Alexandre<br>&gt; <br>&gt; <br>&gt; Ivan Carreira wrote:<br>&gt; &gt; Thanks for the help. I am starting to use openlayers and I do not know <br>&gt; &gt; much about this.<br>&gt; &gt; The idea is:<br>&gt; &gt; -Deactivating a layer in the legend,  make the query, and not display <br>&gt; &gt; the popup<br>&gt; &gt; -Activating a layer in the legend, make the query, and not display the <br>&gt; &gt; popup<br>&gt; &gt;<br>&gt; &gt;  Being tested with the following:<br>&gt; &gt;<br>&gt; &gt; var showInfo = function(event) {<br>&gt; &gt;                 var layers  = map.layers;                             <br>&gt; &gt;            <br>&gt; &gt;             if(event)<br>&gt; &gt;             {<br>&gt; &gt;                  for (var i = 0; i &lt; layers.length; i++) {<br>&gt; &gt;<br>&gt; &gt;                       if (!layers[i].getVisibility())<br>&gt; &gt;                <br>&gt; &gt;                 {<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; but I do not know how to continue.<br>&gt; &gt;<br>&gt; &gt; Regards,<br>&gt; &gt;<br>&gt; &gt; Iván<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Hi,<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Do you mean visible OpenLayers layers or server side-layers ? Do you<br>&gt; &gt; &gt; use (1) one OL layer per server-side layer or (2) are they all in the<br>&gt; &gt; &gt; same OL layer ?<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; If (1) : loop through your map layers for each visible/inRange layer<br>&gt; &gt; &gt; to get their params.['LAYERS'] property. If they come from the same<br>&gt; &gt; &gt; server, you can merge them in a single request.<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; If (2) : If you use MapServer and you have direct access to the<br>&gt; &gt; &gt; mapfile, you could do the following. Please, anyone correct me if I'm<br>&gt; &gt; &gt; wrong, but I think getfeatureinfo requests are made regardless of a<br>&gt; &gt; &gt; layer's minscaledenom or maxscaledenom property. So you could create a<br>&gt; &gt; &gt; template with leg_layer_minscale and leg_layer_maxscale values to get<br>&gt; &gt; &gt; theses values from the server-side into a javascript array. Also, add<br>&gt; &gt; &gt; the layer name at the same time (because that's the value to be <br>&gt; &gt; added to<br>&gt; &gt; &gt; the query_layers query property). Then, on click, you could loop <br>&gt; &gt; through<br>&gt; &gt; &gt; this array to check that the layers are currently visible (compare with<br>&gt; &gt; &gt; current scale). See that (3) link for more details. Does that make <br>&gt; &gt; sense ?<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; (3) http://mapserver.org/output/html_legend.html<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Regards,<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Alexandre<br>&gt; &gt; &gt;<br>&gt; &gt; &gt; Ivan Carreira wrote:<br>&gt; &gt; &gt; &gt; Hi all,<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; I have a problem.<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; I need an expression to limit queries only to the layers that are <br>&gt; &gt; visible at that time on the map.<br>&gt; &gt; &gt; &gt; Queries are displayed via a popup.<br>&gt; &gt; &gt; &gt; The code where queries are made and displayed in the popup is as <br>&gt; &gt; follows:<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; var showInfo = function(event) {<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; var pixel = event.xy;<br>&gt; &gt; &gt; &gt; var lonlat = this.getLonLatFromPixel(pixel);<br>&gt; &gt; &gt; &gt; var message = null;<br>&gt; &gt; &gt; &gt; var params = {};<br>&gt; &gt; &gt; &gt; params['service'] = 'wms';<br>&gt; &gt; &gt; &gt; params['request'] = 'GetFeatureInfo';<br>&gt; &gt; &gt; &gt; params['version'] = '1.1.1';<br>&gt; &gt; &gt; &gt; params['info_format'] = 'text/plain';<br>&gt; &gt; &gt; &gt; params['srs'] = this.getProjection();<br>&gt; &gt; &gt; &gt; params['bbox'] = this.getExtent().toBBOX(6);<br>&gt; &gt; &gt; &gt; params['width'] = this.getSize().w;<br>&gt; &gt; &gt; &gt; params['height'] = this.getSize().h;<br>&gt; &gt; &gt; &gt; params['feature_count'] = 1;<br>&gt; &gt; &gt; &gt; params['x'] = pixel.x; .<br>&gt; &gt; &gt; &gt; params['y'] = pixel.y;<br>&gt; &gt; &gt; &gt; params['layers'] = 'camino';<br>&gt; &gt; &gt; &gt; params['query_layers'] = 'camino';<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; new OpenLayers.Request.GET({<br>&gt; &gt; &gt; &gt; url: server,<br>&gt; &gt; &gt; &gt; async: false,<br>&gt; &gt; &gt; &gt; params: params,<br>&gt; &gt; &gt; &gt; success: function(data) {<br>&gt; &gt; &gt; &gt; message = data.responseText;<br>&gt; &gt; &gt; &gt; }<br>&gt; &gt; &gt; &gt; });<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; message = getHTML(message);<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; var popup = new OpenLayers.Popup.FramedCloud('popup', lonlat, <br>&gt; &gt; null, message, null, true, null);<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; this.addPopup(popup);<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; };//End of function showInfo()<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt; map.events.register('click', map, showInfo);<br>&gt; &gt; &gt; &gt;<br>&gt; &gt; &gt; &gt;<br>&gt; &gt;<br>&gt; &gt; &gt;<br>&gt; &gt;<br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt; Ahora, GRATIS Hotmail en tu móvil ¡Descúbrelo aquí! <br>&gt; &gt; &lt;http://serviciosmoviles.es.msn.com/hotmail.aspx&gt;<br>&gt; &gt; ------------------------------------------------------------------------<br>&gt; &gt;<br>&gt; &gt; _______________________________________________<br>&gt; &gt; Users mailing list<br>&gt; &gt; Users@openlayers.org<br>&gt; &gt; http://openlayers.org/mailman/listinfo/users<br>&gt; &gt;   <br>&gt; <br>&gt; <br>&gt; -- <br>&gt; Alexandre Dubé<br>&gt; Mapgears<br>&gt; www.mapgears.com<br>&gt; <br><br /><hr />Haz búsquedas con Live Search,  <a href='http://www.buscalasuerte.com/' target='_new'>¡todas tus búsquedas tienen premio!</a></body>
</html>