Select to view content in your preferred language

How to get legend information using a REST endpoint and what to do with it

766
3
06-06-2011 02:48 PM
BranonBarrett
Emerging Contributor
I have an issue where I am adding layers to a map service dynamically and I need to keep the legend information in sync; however, after I add the layer to the map service/refresh the REST cache/then set the visible layers on the service on the client side the legend information (i.e. the images) are not refreshed. I tried simply calling the Legend.Refresh method, but that does not force the server to send a new image. Once the ArcGISDynamicMapServiceLayer has been initialized (and any subsequent initialize call) does not return a new legend information.

Is there any way to set the Image source for a legend item using a REST endpoint (ex. http://localhost/ArcGIS/rest/services/UserLayers/MapServer/Legend/0?f=json&pretty=true)?

Am I stuck building a custom legend control for this seemingly straight forward issue?

Any ideas would be greatly appreciated.
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
Did you try to set DisableClientCaching to true for your ArcGISDynamicMapServiceLayer ?
0 Kudos
BranonBarrett
Emerging Contributor
I did, and that did not work. It appears that property only refers to caching the map images? Any other ideas?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Oops, you are right the legend infos are cached at the client side once the first query has been done.

I guess it's a bug we need to fix in a future version.

I'll try to find a workaround and let you know:confused: (at least the creation of a new layer should work. OK it's awful, I agree)
0 Kudos