2

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.....

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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