[OpenLayers-Users] WFS.fromWMSLayer selection question

Dragan Podvezanec dragan.podvezanec at gmail.com
Wed Nov 18 15:56:34 EST 2009


Hi all.

I have 10 WMS layers (polygons) which do not overlap. I'm trying to panZoom
to the center of the polygon which user clicked. I registered
"featureselected" events on all WMS layers, like this:

for(var i in map.layers[layer]) {		
						mapa.events.layers[layer] = new OpenLayers.Control.GetFeature({
						protocol: OpenLayers.Protocol.WFS.fromWMSLayer(map.layers[layer],{
							geometryName: 'geometry',
							srsName: "EPSG:900913"
							}),
							hover: false
						});

						mapa.events.layers[layer][i].events.register("featureselected", this,
function(e) {

						var objekt = e.feature;
						var bbox = (objekt.geometry.bounds);
						var newcenter = (bbox.getCenterLonLat());
						mapa.panTo(newcenter);
}

And this works. Map gets centered to the object that I have clicked. But as
I see, there are 10 post request to Geoserver, featureselected is triggered
on every WMS layer. Is this not an overhead? Why is event featureselected
triggered, even I have clicked outside a layer?

1. Is this normal behavior?
2. What would happen if I have 100 layers?
3. Should I use different approach? (To make invisible WFS layers on top of
WMS layers, and then register featureselected to WFS layers?)
-- 
View this message in context: http://n2.nabble.com/WFS-fromWMSLayer-selection-question-tp4028249p4028249.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list