[OpenLayers-Users] Highlight on hover

François Van Der Biest francois.vanderbiest at camptocamp.com
Fri Sep 4 10:13:05 EDT 2009


Hi Steve.

A potential reason is that the GML you're receiving does not use the
same SRS as the one of your map.
You may check this using FireBug.

I know GeoServer does not handle reprojecting features returned by WMS
getFeatureInfo.

Cheers,
F.


On Fri, Sep 4, 2009 at 3:52 PM, <Steve.Toutant at inspq.qc.ca> wrote:
>
> 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
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>



More information about the Users mailing list