Select to view content in your preferred language

How to do maptips

1071
3
03-07-2011 11:25 AM
DonFreeman
Emerging Contributor
I am assuming the maptip sample shown at http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerMapTips will only work with a featurelayer which requires a featureservice. Is that correct?

So if my map uses a ArcGISDynamicMapServiceLayer I then need to follow the sample shown at http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GraphicsMapTip . Correct?

I have copied the latter into my project dropping the second layer (Cities) and chenged the name of the States layer and code to MapTipGraphicsLayer. I believe I have changed all the pertinate references but I don't get any action when the mouse hovers over a feature. (No triggering of MapTipGraphicsLayerQueryTask_ExecuteCompleted.) The one line I do not understand is
ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query()
   {
    Geometry = new ESRI.ArcGIS.Client.Geometry.Envelope(-180, 0, 0, 90),
    OutSpatialReference = MyMap.SpatialReference
   };
Perhaps this needs to be changed somehow to fit my map? Or maybe someone can suggest what else I should look for?
Thanks
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
What is the spatialreference of your map?
As you are giving a query envelope in geographical coordinates, your code can only work with a geographical map spatial reference.

When the query is completed, how many features are returned?
0 Kudos
DanielWalton
Frequent Contributor
Don, see my post in the other Maptip thread. MapTips won't work on ArcGisDynamicMapServiceLayer. You need to use a FeatureLayer in some capacity. Or, if you really don't want to use a FeatureService, you have a couple of options:
1) try using a modified Toolkit MapTip widget to display the results of an identifytask. If you're interested in that route I can share some code with you.
2) create an empty graphicslayer and copy graphics into it from the results of an identify task
0 Kudos
JTessier
Frequent Contributor
Hi all interested parties, it is not a matter of wanting to use a FeatureService, it is the limitations imposed by such:  all data in the mxd supporting a FeatureService must be in SDE, which means that any other data such as shapefiles and geodatabases which may be products of other business lines, must be served as additional map services, which then makes layer draw order a problem as those from one service will always be rendered on top of others in another mapservice.  This further complicates the issue because tools such as identify and query, and especially print, need to be programmed to work upon multiple map services, a time consuming task, depending on the robustness of the implementation. 

The example Don linked to at the top of this thread (http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GraphicsMapTip) does not seem to require a featureservice (please correct me if I am mistaken) but shows how to pretty much hardcode in maptipped layers for a dynamic map service using a query task and code that runs when the map is loaded. 

I think this presents another option that does not require the user to use an identify tool (click event). 

Following this, has anyone written a configurable maptips originator (prevent hardcoding to rest service urls) they might share?

Thanks!
-J
0 Kudos