[OpenLayers-Users] Interactive hot spots on a map for large, complex vector geometries

Phil Scadden p.scadden at gns.cri.nz
Sun Jun 29 15:46:09 PDT 2014


> I guess I forgot to mention: the idea is to have geometries 
> highlighting on hover / mouse-over...
Yep. I do that. Do WFSgetfeature in a hover handler.

eg
    hoverHandler = new OpenLayers.Handler.Hover({
         map:map
     },{});
     hoverHandler.callbacks= {
         "pause":function(e){
   // do WFSgetfeature here
         }
     };
hoverHandler.activate();


Or,
  hoverFeatures =  new OpenLayers.Control.GetFeature({
                 protocol:myWfsProtocol,
                 hover: true,
                 propertyNames:myListOfFields,
                 click:false,
                 maxFeatures:1
               });
               hoverFeatures.events.register("hoverfeature", this, 
showFeature);
               hoverFeatures.events.register("outfeature", this, 
function(evt) { clearFeature;});

Or, have serverside function that is called on hover, which in turns 
make the WFS call to fetch the geometry and simplifies it based on zoom 
before passing up has GML. Ie do everything serverside if possible since 
js is so slow.

You might want to look at the SLDSelect control which could also be 
called on Hover.

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