Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up a WFS layer in openlayer:

 var v1497_shp = new OpenLayers.Layer.Vector("v1497_shp", {
     strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
     //projection: new OpenLayers.Projection("EPSG:26910"),
     protocol: new OpenLayers.Protocol.WFS({
         version: "1.1.0",
         // loading data through localhost url path
         url: "http://localhost/geoserver/wfs",
         featureNS :  "",
         maxExtent: mapextent,
         // layer name
         featureType: "v1497_db_wfs",
         // geometry column name
         geometryName: "the_geom",
         schema: "http://localhost/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:v1497_db_wfs"

Now i want to highlight the layer when i pass over with the mouse. how can i do this?

Ay idea? Thank you.

share|improve this question
up vote 3 down vote accepted

only using highlight features on hover:

(this examples also show how eventListeners are used with beforefeaturehighlighted, featurehighlighted, featureunhighlighted)

 var info = function(evt) {

 var highlight = new OpenLayers.Control.SelectFeature(v1497_shp, {
                hover: true,
                highlightOnly: true,
                renderIntent: "temporary",
                eventListeners: {
                    beforefeaturehighlighted: info ,
                    featurehighlighted: info ,
                    featureunhighlighted: info 


working examples here...

i hope it helps you...

share|improve this answer
it works! thank you! – Michele 2 May 9 '12 at 12:57

Use a SelectFeature control with hover and higlightOnly

var select = new OpenLayers.Control.SelectFeature(v1497_shp, { highlightOnly: true, hover: true });
select.activate();"featurehighlighted",this,function(e){console.log("hover ",e);});
share|improve this answer
it works! thank you! – Michele 2 May 9 '12 at 12:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.