[OpenLayers-Users] Highlighting Selected Tract

Jerome A. Wendell jawendell at digitalmapping.com
Mon Mar 4 06:08:23 PST 2013


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: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Phil Scadden
Sent: Sunday, March 03, 2013 7:48 PM
To: openlayers-users at lists.osgeo.org
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
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list