[OpenLayers-Dev] Hover over point - Display name

Alexandre Dube adube at mapgears.com
Thu Apr 15 10:33:58 EDT 2010


Joe,

You can't. You can only use it with Vector features. If you're planing 
to use WMS only, you can use the GetFeatureInfo control triggering 
requests when the mouse stops for a brief moment and display a div with 
the name of the feature hovered.

Here's an other solution (still using WFS to get and draw vector 
features though, you'll need to make sure that you have a WFS server setup):
http://www.openlayers.org/dev/examples/getfeature-wfs.html

Unfortunately demo.opengeo.org seems to be down for the moment so you 
won't be able to see it live, but look a the source and you should be 
able to reproduce the same thing in your application. Basically, with 
the demo you can draw boxes on the map and a WFS GetFeature request is 
sent and the returned features are drawn as vector features on the map, 
looking as they were highlighted. It might be a bit too much for what 
you want, but it's good to see alternatives.

IMHO, a WMS GetFeatureInfo request should be enough. See (instead of 
triggering requests on map click, make it happen on mouse move stopped):
http://www.openlayers.org/dev/examples/getfeatureinfo-popup.html

See also :
http://www.openlayers.org/dev/examples/hover-handler.html

Hope this helps,

Alexandre


geojoe wrote:
> It turns out the layer I'm using for hover is a WMS layer and the features
> property is NULL.  
>
> How do I use hover with a WMS layer?
>
> Joe
>
>   


-- 
Alexandre Dubé
Mapgears
www.mapgears.com




More information about the Dev mailing list