[OpenLayers-Users] Add background features to map

Phil Scadden p.scadden at gns.cri.nz
Mon Jul 14 20:30:36 PDT 2014


You can do most of this with just WMS. It depends to some extent on your 
tolerance for how long mouse is hovering before display.

First off, a hell of lot of geometry is not that big an issue to caching 
WMS server (eg Geoserver). Only images are passed. Your choice.

Second, you have a couple of options for displaying features on hover or 
click. If the geometry is very complex (over 100 nodes), then consider 
using the SLDSelect Control 
http://openlayers.org/dev/examples/SLDSelect.html with a hover handler. 
This does it all with WMS. Otherwise, set up a GetFeature control.
eg
                hoverFeatures =  new OpenLayers.Control.GetFeature({
                    protocol: myWfsProtocol,
                   hover: true,
                   click:false,
                   maxFeatures:1
                });
                hoverFeatures.events.register("hoverfeature", this, 
displayTheFeature);
                hoverFeatures.events.register("outfeature", this, 
unDisplayTheFeature);
the event handlers will draw the feature from the gml geometry


Notice: This email and any attachments are confidential.
If received in error please destroy and immediately notify us.
Do not copy or disclose the contents.



More information about the Users mailing list