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