In regards to displaying a ArcGISTiledMapServiceLayer in a legend widget with the JavaScript 3.26 API (see code and layer below). The legend is displaying the layer's symbology, but it is simultaneously displaying a set of symbology, one for each scale cached into the service layer. The results of which is that I see (the same) symbology in the legend for all scales. I am only interested in the legend displaying the correct symbols based on the map's current display scale. Any way to javascript code my way around this? BTW- I am not the owner of this layer.
basemaplayerStreet = new esri.layers.ArcGISTiledMapServiceLayer("http://maps.cityofmobile.org/ArcGIS/rest/services/Base_Cache/MapServer",
{id: 'City Base'});
map.on("layers-add-result", function (results)
{
var legendDijit = new Legend
({map: map,}, "legendDiv");
legendDijit.startup();
}); /*end layers-add-result*/
map.addLayer(basemaplayerStreet);
Solved! Go to Solution.
Mark,
Because ArcGISTiledMapServiceLayer just returns cached tiles from the server you have no control over what layer are displayed. You would have to switch to a ArcGISDynamicMapServiceLayer and it will only show the layers based on their visible scale.
Mark,
Because ArcGISTiledMapServiceLayer just returns cached tiles from the server you have no control over what layer are displayed. You would have to switch to a ArcGISDynamicMapServiceLayer and it will only show the layers based on their visible scale.
Robert,
Thanks and that was what I was thinking. Guess the alternative is a fixed image representing a legend inside of a dojo ‘contentpane’.
Mark,
Yep that is a good option. Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.