Info Window popup on mouse hover without using graphics

2330
5
05-24-2011 01:31 PM
by Anonymous User
Not applicable
Original User: zorbac

Hi,
My application uses a graphics layer to pop up an info window on mouse over event. This works great as long as there are a limited number of graphics, but as the number of graphics increases (over a thousand now and increasing), it is seriously affecting performance. Performance is degraded both at start-up of app, when graphics are created (I have determined that the slow part is when they are added, one by one to the map), and also whenever the map is refreshed by pan or zoom. My conclusion is that graphics are not very scalable so I need an alternative way to achieve this functionality.

So, can you do this without graphics? I know I can use the identify task for a click event, but I need this to work with a mouse over, not click.

If, as I suspect, this does require graphics or a feature layer (a type of graphic), I'd appreciate any suggestions to improve performance. As I said, graphic layer is used at this time. Would switching to a feature layer have any effect on performance? My other thought is to only add the graphics to the map when they are needed, which is only at large scales, and only when the user has a certain tool selected. I think this would work, but it seems a bit complicated. Testing for current scale and tool is not too hard but keeping track of which graphics have already been added so as not to add them multiple times could be tricky.

The application is built with the 1.5 version api, but I can upgrade to 2.3 or whatever to take advantage of feature layers. I can post some code if helpful, but right now I'm just looking for ideas or possible solutions.

Thanks.
0 Kudos
5 Replies
derekswingley1
Frequent Contributor
I would seriously consider moving to a feature layer. If you use ONDEMAND mode, only features in the current extent are fetched and drawn. This should minimize the amount of graphics on your map at any one time. You can use the same infoWindow on hover strategy you're currently using with graphics with a feature layer.
0 Kudos
by Anonymous User
Not applicable
Original User: zorbac

Derek,
Thanks for the reply. Yes, I am looking into the feature layer. On-demand mode looks like just what i need. One issue I can forsee - what if the user zooms to full extent of the map? The feature layer would then request all features and I would be back to my performance issue.

I noticed that feature layers honor the scale dependancies of the layer in the service from which they are derived. So, if I set that layer to only be visible at large scales, maybe this would solve the above issue? Does this make sense?
0 Kudos
derekswingley1
Frequent Contributor
Yes, I think that's a good strategy.
0 Kudos
by Anonymous User
Not applicable
Original User: stevel

Zorba,

Feature layers with a scale dependency would definitely help here.

You can also experiment with the maxAllowableOffset parameter, which will simplify line and polygon layers on-the-fly. So when you zoom out, you could display a simplified version of complex layers, which is a lot faster.

See the sample at http://help.arcgis.com/en/webapi/javascript/arcgis/demos/fl/fl_generalize.html and View Source to discover how it works.

For point features, you could use a clusterer. There's nothing out-of-the-box for this yet, but there's a good sample at http://geochalkboard.wordpress.com/2010/09/09/clustering-with-the-arcgis-server-javascript-api/

Good luck,
Steve

PS you should definitely upgrade to the latest version of the API!
0 Kudos
by Anonymous User
Not applicable
Original User: zorbac

Steve,
Yes, the graphics in my case are points. I checked out the demo of clustering. Very cool. thanks for the tip. I have gone ahead with upgrading to 2.3 api. It was pretty smooth except it caused some wierd style deffects to some of the dojo widgets in the app like the datagrid and combobox.

Cheers

Zorba
0 Kudos