ArcGIS API for Silverlight中legend控件显示图例问题
转自http://www.gisall.com/html/34/9534-5141.html
在使用ArcGIS API for Silverlight进行地图展示应用的时候,我们都会设置地图图层列表的图例(该图例包含有图层名称和图层符号),但是在使用API时却出现了图例无法正常显示,该图例只显示了图层名称,却无法显示图层的符号颜色的问题。查看ArcGIS API for Silverlight的接口说明,没任何说明。但是在ArcGIS API for Flex的接口说明确发现如下信息:
The Legend component displays labels and symbols for some or all of the layers in the map. By default the legend will respect scale dependencies and only display layers and sublayers that are currently visible in the map. Optionally, you can set the respectCurrentMapScale property to false to show all layers at all scales, then layers that are not in scale will be shown - with 50% transparency. The legend automatically updates if the visibility of a layer or sublayer changes.
The legend supports the following layer types: ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, and FeatureLayer. If the layer is an ArcGISDynamicMapServiceLayer or ArcGISTiledMapServiceLayer created using ArcGIS Server 10.0 SP1 or higher the legend is generated using the REST Map Service legend resource of that service, e.g. http://server.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Unemployment_Rate/MapServer/legend. If the layers are version 10 or lower the legend is created using the ArcGIS.com legend service. In order to use the ArcGIS.com legend service your map service needs to be publicly accessible and your application must be able to access ArcGIS.com.
The legend for feature layers is created using the layer's drawing info, for example: http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0.
通过上述描述我们发现导致这个问题的原因是因为使用ArcGIS Server10版本或更低的发布地图服务(静态或动态类型)是不能使用ArcGIS API for Silverlight的Legend控件进行图例显示,但是使用FeatureLayer类型却可以正常显示图例.
而要正常显示本地静态或动态类型的地图服务则需要将ArcGIS Server10版本打补丁到SP1或以上版本就可以实现了。