[OpenLayers-Users] Highlight Features from WMS Layer

Jerome A. Wendell jawendell at digitalmapping.com
Mon Mar 4 11:23:14 PST 2013


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:rajjad at gmail.com] 
Sent: Monday, March 04, 2013 2:08 PM
To: jawendell at digitalmapping.com
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
<jawendell at digitalmapping.com> 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:gamejihou at hotmail.com] 
Sent: Monday, March 04, 2013 12:41 PM


To: jawendell at digitalmapping.com
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" <jawendell at digitalmapping.com>
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
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users





 

-- 
I.R 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130304/ffa8a117/attachment.html>


More information about the Users mailing list