MapImageLayer - 在子图层上设置渲染器

尝试一下在线预览

MapImageLayer 子图层 属性允许你动态设置地图服务中的图层渲染器。为此,您必须引用服务图层的图层 ID,并将渲染器分配给子图层的 渲染器 属性。

                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const layer = new MapImageLayer({
  url: "https://sampleserver6.geosceneonline.cn/arcgis/rest/services/USA/MapServer",
  sublayers: [
    {
      id: 2,
      renderer: {
        type: "simple", // autocasts as new SimpleRenderer()
        symbol: {
          type: "simple-marker", // autocasts as new SimpleMarkerSymbol()
          size: 3,
          color: "white"
        }
      }
    }
  ]
});

要查看地图服务中图层的默认渲染器,请删除对此示例中定义的渲染器的引用或查看 MapImageLayer - 切换子图层的可见性 示例。

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.