I added the addFeatures logic to the anonymous function.  When I select a
feature, it is still not highlighted.  Since the features are from a WMS
layer, is the "select" styling handled in geoserver?  It does not appear
that the styles that I setup in OpenLayers are being used.  I don't see
their definition in Firebug.  The revised code is below:

var selectControl = new OpenLayers.Control.WMSGetFeatureInfo({
                                url:
'http://166.78.30.120:8080/geoserver/wv_data/wms',
                                title: 'Identify features by clicking',
                                layers: [wvmineraltracts],
                                queryVisible: true,
                                hover: false,
                                eventListeners: {
                                getfeatureinfo: function(event) {
                                if (!event.text.match(/<body>\s*<\/body>/)){
                                        if (popup)
                                        {
                                                popup.destroy();
                                                popup = null;
                                        }
                                        popup = new
OpenLayers.Popup.FramedCloud(
                                                "popup",
        
map.getLonLatFromPixel(event.xy),
                                                null,
                                                event.text,
                                                null,
                                                true
                                        );
                                map.addPopup(popup);
                                }
                                if (event.features && event.features.length)
{
                                        highlightLayer.destroyFeatures();
        
highlightLayer.addFeatures(event.features);
                                        highlightLayer.redraw();
                        }
                                }
                        }
        });

Thanks,

Jerome


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Phil Scadden
Sent: Sunday, March 03, 2013 7:48 PM
To: [email protected]
Subject: Re: [OpenLayers-Users] Highlighting Selected Tract

You have effectively added getfeatureinfo to the selectControl twice - once
as an anonymous function in the selectControl and then a second time with
register. Since popup is working, this seems to by active one. 
Add the addFeatures(event.features) logic to the anonymous function.

Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.

_______________________________________________
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

Reply via email to