I'm building a client using the ArcGIS WPF libraries, that's displaying my entities on a world map. I'm using an ArcGISDynamicMapServiceLayer to display the geographic and topographic base map, and I'm now wondering what's the best way to show my custom entity layer.

At first, I used a FeatureLayer object, linked to the layer's published URL, to display the entities on the map. This worked great in that it showed the entity symbology and allowed me to interact with it (catch right-clicks, select/deselect), but it doesn't show the labels associated with the entity, just the symbology.

So I tried using a second ArcGISDynamicMapServiceLayer to display the entities, which gives me data labels, but without the interactivity.

So now, since these are both client requirements, I find myself using BOTH, and synchronizing visibility between the two instances of the layer, once as a FeatureLayer, and once under a dynamic layer. This is not a good practice, and bugs rear their head constantly.

So my question is - what's the best way to achieve those two goals? Is there a simple way to add my own data labels on the map for each entity? There could be hundreds of them on 5-6 of these entity layers, and this feels like replicating functionality that ArcGIS already offers. On the other hand, I can simulate the right-click-on-entity behavior using a DynamicMap, catching the MouseClick event, and running a Query action on the map to find the entities clicked, but this, again, is reinventing parts of the wheel, and leaves some unsolved issues.

So what would you do? How do I get those two requirements together without ugly hacks?

  • For what it's worth, I think your workaround of displaying a labelled Dynamic Layer, and using a Query for the other functionality, isn't too convoluted. I believe I've seen it mentioned as the "correct" method, but I can't find the reference – Stephen Lead Feb 9 '12 at 9:08
  • I was hoping for a more elegant, out-of-the-box method. :) The problem with this workaround is that when using a FeatureLayer, I can register for the right-click event, and get notified whenever a symbol on the map is clicked, receiving the Graphic element as part of the event arguments. When doing it manually, I have to register to the map's event, get a pixel-coordinates, and do my own guesswork on how big the map symbol is and whether the user actually clicked on it. – Avner Shahar-Kashtan Feb 9 '12 at 9:16
  • Can you include labels in the Dynamic layer, but no symbols, and have the symbols in the feature/graphic layer? Or is that what you mean in your 4th paragraph above? What bugs are rearing their heads? – Stephen Lead Feb 9 '12 at 9:20
  • I have a list of checkboxes, for each layer, so the user can show or hide individual layers when working. I now have to synchronize them manually, showing both the feature layer and the inner-layer inside the dynamic layer when the user clicks. This, for some reason, doesn't always work smoothly, with the VisibleLayers property on the Dynamic layer not always up to date. Additionally, I sometimes have to manually refresh a layer in response to a server request. I can call the map's UpdateFeatureLayer behavior, but not for the dynamic layer. Trying to find a solution to that one now.' – Avner Shahar-Kashtan Feb 9 '12 at 9:23
  • 4
    This question appears to be off-topic because it is about an issue being seen by a user 18 months ago, and who has not logged into this site since very shortly after that. – PolyGeo Oct 1 '13 at 23:28