Gery,
Thanks for your reply. I set both hover and box to false so that the event only occurs on select. Thanks. From: Gery . [mailto:[email protected]] Sent: Monday, March 04, 2013 3:36 PM To: [email protected]; 'Imran Rajjad' Cc: 'OpenLayers User List' Subject: RE: [OpenLayers-Users] Highlight Features from WMS Layer I don't work with Geoserver, but where do you call your features? and definitely you need GetFeature for this. About the "0" problem, is it perhaps you have hover and box as false? ____________________________________________________________________________ ______________ Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario. Think green - keep it on the screen. Do NOT print if it is NOT necessary. Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie es NICHT, wenn es NICHT notwendig ist. _____ From: [email protected] To: [email protected] CC: [email protected]; [email protected] Subject: RE: [OpenLayers-Users] Highlight Features from WMS Layer Date: Mon, 4 Mar 2013 14:23:14 -0500 Imran, Thanks for the input. I have added a GetFeature control and a highlight layer based on http://openlayers.org/dev/examples/getfeature-wfs.html as follows: var highlightLayer = new OpenLayers.Layer.Vector("Highlighted Features", { styleMap: myStyles, displayInLayerSwitcher: false, isBaseLayer: false } ); var highlightControl = new OpenLayers.Control.GetFeature({ protocol: OpenLayers.Protocol.WFS.fromWMSLayer(mylayer), box: false, hover: false, maxFeatures: 20 }); highlightControl.events.register("featureselected", this, function(e) { highlightLayer.addFeatures([e.feature]); }); highlightControl.events.register("featureunselected", this, function(e) { highlightLayer.removeFeatures([e.feature]); }); map.addControl(highlightControl); highlightControl.activate(); The selected features are not being added to the highlightLayer layer. According to Firebug, the numberOfFeatures="0". Do you have any idea why there are no features being returned? I use geoserver and WFS is enabled. Thanks, Jerome From: Imran Rajjad [mailto:[email protected]] Sent: Monday, March 04, 2013 2:08 PM To: [email protected] Cc: Gery .; OpenLayers User List Subject: Re: [OpenLayers-Users] Highlight Features from WMS Layer hi, to make highlighting work, you will need to put your features in a vector layer anyway.. regards, Imran On Mon, Mar 4, 2013 at 11:32 PM, Jerome A. Wendell <[email protected]> wrote: Gery, Thanks for your reply. I have been searching a number of sites for the answer, but did not really find a definite answer. So, now I know I need to add another control. I appreciate your help. Jerome From: Gery . [mailto:[email protected]] Sent: Monday, March 04, 2013 12:41 PM To: [email protected] Cc: OpenLayers User List Subject: Re: [OpenLayers-Users] Highlight Features from WMS Layer I think so, there are several posts about that in gisexchange.com Sent from my iBath On Mar 4, 2013, at 18:18, "Jerome A. Wendell" <[email protected]> wrote: I have a control using WMSGetFeatureInfo that displays attributes of the selected features from a WMS layer in a popup. I have tried unsuccessfully to also highlight the features selected in that same control by adding them to a highlight layer. Do I need a separate control using GetFeature in order to highlight the selected features? Any help would be greatly appreciated. Thanks. _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users _______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users -- I.R
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
