Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
        dojo.connect(map,'onLayersAddResult',function(results){
          var layerInfo = dojo.map(results, function(layer,index){
            return {layer:layer.layer,title:layer.layer.name};
          });
          if(layerInfo.length > 0){
            var legendDijit = new esri.dijit.Legend({
              map:map,
              layerInfos:layerInfo
            },"legendDiv");
            legendDijit.startup();
          }
        });

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

share|improve this question
add comment

1 Answer

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

share|improve this answer
add comment

Your Answer

 
discard

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.