[OpenLayers-Users] Highlight on hover

Steve.Toutant at inspq.qc.ca Steve.Toutant at inspq.qc.ca
Fri Sep 4 09:52:33 EDT 2009


Hello,
With the code below, a GetFeatureInfo request is succesfully launched to 
mapserver when I stop moving the mouse. In firebug I see the XML response 
with the msGMLOutput tag. 
I can see that the highlightLayer has feature added to it but I don't see 
them on the map. Like there is no geometry.
What could be the reasons for that please? Is there some params missing?

Thanks
Steve

var highlight_style = { fillColor:'#99CCFF', strokeColor:'#3399FF', 
fillOpacity:0.7 };
highlightLayer = new OpenLayers.Layer.Vector("HighlightedFeatures", 
{displayInLayerSwitcher: false, features:[], isBaseLayer: false, 
visibility:true, style:highlight_style}); 

infoControls = 
{
                hover: new OpenLayers.Control.WMSGetFeatureInfo
                ({
                title: 'Identify features by clicking',
                layers: [overlays['national_2006']],
                hover: true,
                queryVisible: true
                ,infoFormat:'application/vnd.ogc.gml'
                })
}
// add layers to the map
addLayersToMap();

for (var i in infoControls) 
{
        infoControls[i].events.register("getfeatureinfo", this, showInfo);
        map.addControl(infoControls[i]);
        infoControls[i].activate();
}

function showInfo(evt) 
{
        if (evt.features && evt.features.length) 
        {
                 highlightLayer.destroyFeatures();
                 highlightLayer.addFeatures(evt.features);
                 highlightLayer.redraw();
        }
}


Steve Toutant, M. Sc.
Analyste en géomatique
Secteur environnement
Direction des risques biologiques, environnementaux et occupationnels
Institut national de santé publique du Québec
945, avenue Wolfe
Québec, Qc G1V 5B3 
Tél.: (418) 650-5115 #5281
Fax.: (418) 654-3144
steve.toutant at inspq.qc.ca
http://www.inspq.qc.ca
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090904/a3d0db06/attachment.html


More information about the Users mailing list