[OpenLayers-Users] Query only in visible layers

Ivan Carreira carreicm at hotmail.com
Tue May 5 05:27:50 EDT 2009


Hi all,

 

I have a problem.

I need an expression to limit queries only to the layers that are visible at that time on the map.
Queries are displayed via a popup.
The code where queries are made and displayed in the popup is as follows:

var showInfo = function(event) {
				
                var pixel = event.xy;
                var lonlat = this.getLonLatFromPixel(pixel);
                var message = null;
                var params = {}; 
                params['service'] = 'wms'; 
                params['request'] = 'GetFeatureInfo'; 
                params['version'] = '1.1.1'; 
                params['info_format'] = 'text/plain';
                params['srs'] = this.getProjection();
                params['bbox'] = this.getExtent().toBBOX(6);
                params['width'] = this.getSize().w; 
                params['height'] = this.getSize().h;
                params['feature_count'] = 1; 
                params['x'] = pixel.x; .
                params['y'] = pixel.y; 
                params['layers'] = 'camino'; 
                params['query_layers'] = 'camino';
		
		new OpenLayers.Request.GET({
			url: server,
			async: false,
			params: params,
			success: function(data) {
				message = data.responseText;
			}
		});
		
		
		
		message = getHTML(message);
		
		
		var popup = new OpenLayers.Popup.FramedCloud('popup', lonlat, null, message, null, true, null);
		
		this.addPopup(popup);

};//End of function showInfo()

	map.events.register('click', map, showInfo);

_________________________________________________________________
Comparte, crea, disfruta… Descubre todo, en estos vídeos
http://www.windowslive.es 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090505/5a3b41f2/attachment.html


More information about the Users mailing list