Cursor Hover Style Over DynamicMapService

1029
6
02-06-2013 02:58 AM
MattFancher
New Contributor III
I want the cursor style to change from the default to a pointer when the user hovers over features drawn in an ArcGISDynamicMapServiceLayer.  Currenty I'm accomplishing that by using a transparent FeatureLayer with the same extent as the DynamicMapServiceLayer.  I use the onMouseOver and onMouseOut events of the FeatureLayer to change the MapCursor property of the map appropriately.  Is there a better way to do that?  Thanks in advance.

Map URL:

http://maps.puc.state.oh.us/esa/index.asp
0 Kudos
6 Replies
derekswingley1
Frequent Contributor
I would say that's the way to go. I'd be curious if anyone else around here has alternative ideas.

Looking at your site, I think the method you're using works well. Are you seeing any issues with the current approach?
0 Kudos
MattFancher
New Contributor III
I think the performance degrades with the FeatureLayer included.  I notice the effect when zoomed in close.  The infoWindow does not respond as quickly and the map navigation gets jerky.  I don't see that behavior when I remove the FeatureLayer.  I tried simplifying the geometry of the data source for the FeatureLayer, but that didn't seem to help, or at least didn't solve the problem entirely.  Maybe I need to simplify it further.  In any case, thanks for the response.  It's good to know I'm at least on the right track.
0 Kudos
derekswingley1
Frequent Contributor
I think the performance degrades with the FeatureLayer included.  I notice the effect when zoomed in close.


Which browser and zoom level? The app works well for me when I'm zoomed in pretty close in Chrome.

I tried simplifying the geometry of the data source for the FeatureLayer, but that didn't seem to help, or at least didn't solve the problem entirely.  Maybe I need to simplify it further.


You shouldn't need to simplify your features, the feature layer does this on the fly by default (for ONDEMAND mode, which you're using) relative to the map scale. More info on this in the "Feature Generalization" section here:  http://help.arcgis.com/en/webapi/javascript/arcgis/jshelp/#best_practices_feature_layers
0 Kudos
StephenLead
Regular Contributor III
Looking at your site, I think the method you're using works well


+1, it looks great.

But why duplicate things by showing both feature and dynamic layers - why not remove the dynamic layer and just use the feature?
0 Kudos
MattFancher
New Contributor III
Derek - I was using IE9 zoomed in to level 14 and closer.  Sometimes I'd click and the infoWindow would popup.  Sometimes I'd click a few times and not get anything.  I can't consistently reproduce the problem though.  Maybe you are right and there isn't one.  Thanks for the tip about feature layer generalization.  I didn't know that.

Stephen - That is a good question.  The short answer is because I did not know how to create the same cartographic effect with a feature layer.  But if that is the way to go, then I'll take another look.  Thanks for the advice.
0 Kudos
MattFancher
New Contributor III
But why duplicate things by showing both feature and dynamic layers - why not remove the dynamic layer and just use the feature?


Stephen - Looks like the "why not" may be a matter of performance.  I tried using a feature layer alone, while maintaining the same symbology, and the draw time suffers.  The feature layer has yet to draw at all in IE9.

http://maps.puc.state.oh.us/esa/index2.asp

The draw time is better in Chrome and Firefox, but still slow.  Am I doing something wrong?  Thanks.
0 Kudos