Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a grid in an MXD that I am publishing using ArcGIS Server 9.3.1.

In the TOC I have made a legend with labels against each of my 5 classifications. I was expecting this to appear in my JS web app - but they never render. Does anyone know how to make a raster legend to work with the ESRI JS API.

The code I am using is direct from the example pages - and it shows a legend for the basemap so I know the code is working to a certain extent:

//add the legend
          var layerInfo =, function(layer,index){
            return {layer:layer.layer,};
          if(layerInfo.length > 0){
            var legendDijit = new esri.dijit.Legend({

UPDATE - Begining to think that this is only available at v10.x.....

share|improve this question

Yes - I can confirm you need ArcGIS Server 10 for this to work.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.