当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


JavaScript ArcGIS Sublayer.id用法及代码示例


基本信息

以下是所在类或对象的基本信息。

AMD: require(["esri/layers/support/Sublayer"], (Sublayer) => { /* code goes here */ });

ESM: import Sublayer from "@arcgis/core/layers/support/Sublayer";

类: esri/layers/support/Sublayer

继承: Sublayer > Accessor

自从:用于 JavaScript 4.1 的 ArcGIS API

用法说明

Sublayer.id函数(或属性)的定义如下:

id Number


子层的层 ID。当图层上未定义源时,该值表示Map服务定义的子图层的 id。如果创建DynamicDataLayer或MapDataLayer并将其添加到子图层的源属性中,则该属性的值可以是开发人员设置的任何值。

例子:

// Creates a MapImageLayer instance containing only the sublayers defined below.
let layer = new MapImageLayer({
  url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
  // this service has four sublayers, but we're only going to include three.
  sublayers: [ { id: 2 }, { id: 1 }, { id: 0 } ]
});
// Creates a MapImageLayer instance containing only the sublayers defined below.
let layer = new MapImageLayer({
  url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer",
  sublayers: [{ // sets a new renderer on this sublayer
    id: 2,
    renderer: {
      type: "class-breaks"  // autocasts as new ClassBreaksRenderer()
      // set renderer properties here
    }
  }, { // sets new labelingInfo on the sublayer
    id: 1,
    labelingInfo: [ new LabelClass( ... ) ]
  }, { // retains properties defined by the service, but makes sublayer not visible
    id: 0,
    visible: false
  }]
});

相关用法


注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 Sublayer.id。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。