Select to view content in your preferred language

Identify Feature by hovering over

5155
11
05-14-2015 02:37 PM
JohnPreston
Deactivated User

Hi, I can easily identify a feature on layer by using onClick and Identifytask. However I would like to identify a feature of specific layers in a map service by hovering over instead of clicking. I tried using a QueryTask but I'm not really querying the layer (I don't have a where). Which method is the best to use?

0 Kudos
11 Replies
ChrisSmith7
Honored Contributor

This is a good base sample for hover tooltips - I ran into some issues with the latency on keeping features highlighted, but ended-up fixing this with some JavaScript trickeration... by tracking highlight graphics in an array and removing those currently not in focus on the next feature hover - works pretty well in removing the latent objects when moving the mouse fast across the map.

Another oddity in functionality concerned the pop-up - if you mouse into the tooltip region, then out onto the basemap (not another fl feature), the graphic remains highlighted with the tooltip shown. Through some more trickeration, I ended-up with something more like this:

2014 Outlook: World Economic Growth Map - Businessweek

It wasn't quite as smooth, but close enough!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

IMHO: Just because you as a programmer can do something does not mean that you should. Why not require a mouse click? You don't see Google maps using a mouse over to reverse geocode every address that mouse is over.  Using a mouse over to display a popup does not make good sense when it comes to user experience or client resource usage. Just something to keep in mind.