Select to view content in your preferred language

Maptips Dynamic Service

2464
2
01-18-2011 09:50 AM
DavidAshton
Frequent Contributor
Hello,

I want create maptips for two dynamic service layers: (Layer name = Detailed Counties; field name = POP2007 and Layer name = Census Block Group; field name = POP2007) from this dynamic map service:  http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer

All the examples I see on the Interactive SDK are geared for Graphics and that is somewhat confusing me.  Can someone point me to an example that just does maptips for a dynamic service or possible so me some code for the example I'm working with.

Thanks
Dave
0 Kudos
2 Replies
JMcNeil
Deactivated User
Check out this sdk example:
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#FeatureLayerMapTips

It uses featurelayers so if you are adding all your layers as a dynamic service and then do something like the example you might be adding the layers twice. 

Why not just use graphic layer maptips. 
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#GraphicsMapTip

Add the graphics on Initial start up and if you have the layers already added by your dynamic map service set your graphic layer colors as fully transparent something like

<esri:SimpleMarkerSymbol x:Name="MapTipMarkerSymbol" Color="#00FFFFFF" Size="12" Style="Circle" />


Also when I have used this maptips for graphics layer in the past I always need to add this line in the code behind

// Return geometry with result features
            query.ReturnGeometry = true;

in the example here is where you would add it:
 query.OutFields.Add("*");
            query.Where = "POP1990 > 100000";

//ADD HERE
// Return geometry with result features
            query.ReturnGeometry = true;


            QueryTask queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0");




Not sure why but when I'm using my own services I need this line, when I'm consuming ESRI services (for the graphic layer creatation) I don't need it...WIERD:p

J
0 Kudos
JenniferNery
Esri Regular Contributor
MapTip is a property in GraphicsLayer (http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.GraphicsLa...). This is why you either see MapTip set on GraphicsLayer or FeatureLayer (inherits from GraphicsLayer http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.FeatureLay...).

What you can do is perform QueryTask on the sub layers and use a GraphicsLayer with MapTip to hold the results (as J suggested). To avoid the features from being added to your map twice, you can set ArcGISDynamicLayers.VisibleLayers property to exclude the sub layer that you already display in the GraphicsLayer.

ReturnGeometry is by default false, which is why you need to set this to true if Geometry need to be retrieved. http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.Quer...
0 Kudos