aaronkilbey

Manually retrieve legendResponse object on layer?

Discussion created by aaronkilbey on Mar 19, 2013
I'm trying to roll my own overlay toggle tree with embedded legend graphics, and I'm finding that if I generate an esri/dijit/Legend, after startup() I then have access to a legendResponse object on the layer (right below layerInfos) which has all the legend images and label info.  Without generating a legend it's not present.  Is there a way to retrieve the content of legendResponse without actually generating a legend? 

The only alternative I see is to hit each sublayer by <service url>/<id>/legend and save the drawingInfo.symbol piece, but this is not a lightweight task if the dynamic service has a ton of layers.

My buddy working on an iOS implementation has AGSMapServiceInfo.retrieveLegendInfo which does this.  Digging into the TOC code, it looks like it's using http://www.arcgis.com/sharing/tools/legend/rest/ service to return this.  Is this something we can install on our own arcgis server?

Outcomes