[OpenLayers-Users] Highlighting feature

Neelima Emmani neelima.emmani at iictechnologies.com
Tue Jun 26 19:33:52 PDT 2012


Hi Horst,
Please add the below piece of code to highlight hovered feature.

var hoverControl =
          new OpenLayers.Control.SelectFeature([layername], {
                box: true,
                hover: true,
                highlightOnly: true,
                renderIntent: "temporary" }
            );
    map.addControl(hoverControl);
    hoverControl.activate();


"layername" --- Please replace with ur layer name .
"temporary" --- This is the style of feature which will appear on hover. Below is the code related to this.

var user_style_tmp= new OpenLayers.Style({strokeColor: "#09DEF2",
                                           strokeOpacity: 0.7,
                                           strokeWidth: 3,
                                           fillColor: '#09DEF2',
                                           pointRadius: 2
                });

userstyleMap = new OpenLayers.StyleMap({'default':user_style_def, 'temporary': user_style_tmp, 'select': user_style_sel});

With Regards,
Neelima Emmani

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


More information about the Users mailing list