类名 ArcGISVectorTileLayer

# new ArcGISVectorTileLayer(options)

ArcGIS矢量瓦片图层 支持通过加载矢量瓦片服务、加载矢量瓦片样式文件和设置矢量瓦片样式的方式创建矢量瓦片图层

[ES5引入方式]:
Zondy.Layer.ArcGISVectorTileLayer()
[ES6引入方式]:
import { ArcGISVectorTileLayer } from "@mapgis/webclient-common"

针对图层的操作请在图层加载完毕事件中进行
Layer.on('layerview-created', function (result) {
console.log("加载完毕:", result.layer)
});
如果不想在该事件中放入业务代码,则请确认图层资源以加载完毕后再进行操作
if(layer.loadStatus === 'loaded') {
// 你的业务逻辑
}

参数:

名称 类型 默认值 描述
options Object

构造参数

url String

服务基地址,
支持矢量瓦片服务,例如:
'https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer',
参考示例:[加载矢量瓦片服务]
支持矢量瓦片样式文件,例如:
'https://jsapi.maps.arcgis.com/sharing/rest/content/items/75f4dfdff19e445395653121a95a85db/resources/styles/root.json',
参考示例:[加载矢量瓦片样式文件]
删除图层方法:[删除图层]

style Object

矢量瓦片样式,也可以支持通过传入矢量瓦片样式的方式构造矢量瓦片,注意矢量瓦片样式要符合arcgis矢量瓦片的规范,
参考示例:[加载矢量瓦片样式]

minScale Number null

最小比例尺,只有当地图视图的比例尺大于最小比例尺时显示矢量瓦片图层

maxScale Number null

最大比例尺,只有当地图视图的比例尺小于最大比例尺时显示矢量瓦片图层

opacity Number 1

图层透明度,0到1之间的值,0为完全透明,1为不透明,参考示例:[设置图层透明度]

tokenKey String 'token'

token名

tokenValue String

token值,只有当tokenValue存在时,才会绑定token

visible Boolean true

图层显示或隐藏,true则显示,false则隐藏,参考示例:[设置图层显隐]

sublayers Array.<ArcGISVectorTileSubLayer> []

子图层信息。指定的和服务器端获取图层的交集, 默认不设置,加载全部图层。可设置子图层的可见性,以及专题图参数。

option.labelsRenderMode String 'off-screen'

指定矢量瓦片注记的渲染模式,仅在三维上有效。on-screen表示使用三维接口实时渲染注记;off-screen表示通过先将注记渲染到图片上,再通过三维接口渲染到屏幕。

options.clippingArea Polygon | Extent | Circle | null null

图层空间裁剪范围,仅支持多边形裁剪、矩形裁剪、圆形裁剪 目前子图层支持的专题图如下:
1、单值专题图
2、分段专题图
3、统一专题图
参考示例:
[1、显示所有子图层]
[2、根据id显示子图层]
[3、通过修改子图参数,设置子图层显隐]
[4、设置子图层专题图-单值专题图]
[5、设置子图层专题图-分段专题图]
[6、设置子图层专题图-统一专题图]
[7、通过修改子图参数,设置子图层专题图]

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 14

支持如下方法:
[1、根据子图层id查询图层]
[2、获取矢量瓦片样式]
[3、通过传入的json构造并返回一个新的几何对象]
4、导出为json对象
5、克隆几何对象
[6、获取图层布局属性]
[7、设置图层布局属性]
[8、获取图层绘制属性]
[9、设置图层绘制属性]
[10、获取图层]
[11、设置图层属性对象]
[12、删除图层]
[13、设置图层可见性]
[14、获取图层可见性]
[15、获取属性过滤条件]
[16、属性过滤]
[17、获取图层最小、最大层级]
[18、设置图层最小、最大层级]

示例

加载矢量瓦片服务

//初始化地图管理容器
// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
const { Map,MapView } = Zondy
// ES6引入方式
import { ArcGISVectorTileLayer,Map,MapView } from "@mapgis/webclient-common"
const map = new Map();
//初始化地图引擎
const mapView = new MapView({
  //指定视图id
  viewId: "viewer-id",
  //绑定地图管理容器
  map: map
});
//添加矢量瓦片图层
const arcgisVectorTileLayer = new ArcGISVectorTileLayer({
  url: 'https://basemaps.arcgis.com/arcgis/rest/services/World_Basemap_v2/VectorTileServer'
});
map.add(arcgisVectorTileLayer);

加载矢量瓦片样式文件

 // ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
const { Map,MapView } = Zondy
// ES6引入方式
import { ArcGISVectorTileLayer } from "@mapgis/webclient-common"
//初始化地图管理容器
const map = new Map();
//初始化地图引擎
const mapView = new MapView({
  //指定视图id
  viewId: "viewer-id",
  //绑定地图管理容器
  map: map
});
//添加矢量瓦片图层
const arcgisVectorTileLayer = new ArcGISVectorTileLayer({
  url: 'https://jsapi.maps.arcgis.com/sharing/rest/content/items/75f4dfdff19e445395653121a95a85db/resources/styles/root.json'
});
map.add(arcgisVectorTileLayer);

加载矢量瓦片样式

 // ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
const { Map,MapView } = Zondy
// ES6引入方式
import { ArcGISVectorTileLayer } from "@mapgis/webclient-common"
//初始化地图管理容器
const map = new Map();
//初始化地图引擎
const mapView = new MapView({
  //指定视图id
  viewId: "viewer-id",
  //绑定地图管理容器
  map: map
});
//添加矢量瓦片图层
const arcgisVectorTileLayer = new ArcGISVectorTileLayer({
  // 设置你的样式
  style: {}
});
map.add(arcgisVectorTileLayer);

设置图层透明度

igsVectorTileLayer.opacity = 0.5

显示或隐藏图层

igsVectorTileLayer.visible = !igsVectorTileLayer.visible

删除图层

map.remove(igsVectorTileLayer)

显示所有子图层

 // ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
// ES6引入方式
import { ArcGISVectorTileLayer } from "@mapgis/webclient-common"
// 添加图层
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer',
  //默认不设置sublayers,加载全部图层
});
map.add(igsVectorTileLayer);

根据id显示子图层

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
// ES6引入方式
import { ArcGISVectorTileLayer } from "@mapgis/webclient-common"
// 添加图层
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer',
  // 根据id显示子图层
  sublayers: [
     {
       // 子图层id
       id: '子图层id',
       // 显示子图层
       visible: true
     }
   ]
});
map.add(igsVectorTileLayer);

通过修改子图参数,设置子图层显隐

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
// ES6引入方式
import { ArcGISVectorTileLayer } from "@mapgis/webclient-common"
// 添加图层
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer'
});
map.add(igsVectorTileLayer);
igsVectorTileLayer.on('layerview-created', function (result) {
  console.log("加载完毕:", result.layer)
  // 根据id获取子图层
  const subLayer = igsVectorTileLayer.findSublayerById('图层id')
  // 设置子图层显隐
  subLayer.visible = false
  // 视点跳转
  sceneView.flyTo({
    extent: result.layer.extent
  })
})

设置子图层专题图-单值专题图

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
const { UniqueValueRenderer } = Zondy.Renderer
const { SimpleFillSymbol,SimpleLineSymbol } = Zondy.Symbol
const { Color } = Zondy
// ES6引入方式
import { ArcGISVectorTileLayer,UniqueValueRenderer ,SimpleFillSymbol,SimpleLineSymbol,Color} from "@mapgis/webclient-common"
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址,当不指定图层名称时,默认查询第一个子图层
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer',
  // 设置子图层专题图
  sublayers: [
     {
       // 子图层id
       id: '子图层id',
       // 设置渲染样式-单值专题图
       renderer: new UniqueValueRenderer({
         //专题图过滤字段名
         field: '你的字段名',
         // 默认样式,当没有匹配到指定值时,会使用默认样式
         //因为该数据的几何类型为区,因此设置区样式
         defaultSymbol: new SimpleFillSymbol({
           // 填充颜色
           color: 'rgba(1,1,252,0)',
           // 外边线样式
           outline: new SimpleLineSymbol({
             //线颜色
             color: new Color(255, 1, 0, 1),
             //线宽
             width: 1
           })
         }),
         //单值专题图过滤调条件数组
         uniqueValueInfos: [{
           //指定字段值
           value: "指定的值",
           //匹配到该值后的样式
           //因为该数据的几何类型为区,因此设置区样式
           symbol: new SimpleFillSymbol({
             // 填充颜色
             color: 'rgba(1,1,252,1)',
             // 外边线样式
             outline: new SimpleLineSymbol({
               //线符号颜色
               color: new Color(255, 1, 0, 11),
               //线宽
               width: 1
               })
             })
           },{
             //指定字段值
             value: "指定的值",
             //匹配到该值后的样式
             //因为该数据的几何类型为区,因此设置区样式
             symbol: new SimpleFillSymbol({
               // 填充颜色
               color: new Color(211, 111, 11, 1)
             })
           }]
       })
     }
  ]
});
map.add(igsVectorTileLayer);

设置子图层专题图-分段专题图

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
const { ClassBreakRenderer } = Zondy.Renderer
const { SimpleFillSymbol,SimpleLineSymbol } = Zondy.Symbol
const { Color } = Zondy
// ES6引入方式
import { ArcGISVectorTileLayer,ClassBreakRenderer ,SimpleFillSymbol,SimpleLineSymbol,Color} from "@mapgis/webclient-commo
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址,当不指定图层名称时,默认查询第一个子图层
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer',
  // 设置子图层专题图
  sublayers: [
    {
     // 子图层id
     id: '子图层id',
     // 设置渲染样式-分段专题图
     renderer: new ClassBreakRenderer({
       //专题图过滤字段名
       field: '你的字段名',
       // 默认样式,当没有匹配到指定值时,会使用默认样式
       // 因为该数据的几何类型为区,因此设置区样式
       defaultSymbol:  new SimpleFillSymbol({
         // 填充颜色
         color: 'rgba(222,1,252,1)',
         // 线符号样式
         outline: new SimpleLineSymbol({
           //线符号颜色
           color: new Color(255, 1, 0, 1),
           //线宽
           width: 1
         })
       }),
       //分段专题图过滤条件数组
       classBreakInfos: [{
         // 最大过滤范围,field对应的值小于maxValue
         maxValue: "最大范围",
         // 最小过滤范围,field对应的值大于等于minValue
         minValue: "最小范围",
         // 匹配到该值后的样式
         // 因为该数据的几何类型为区,因此设置区样式
         symbol:  new SimpleFillSymbol({
           // 填充颜色
           color: 'rgba(1,1,252,1)',
           // 线符号样式
           outline: new SimpleLineSymbol({
             //线符号颜色
             color: new Color(255, 1, 0, 1),
             //线宽
             width: 1
           })
         })
       }]
     })
   }
 ]
});
map.add(igsVectorTileLayer);

通过修改子图参数,设置子图层专题图

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
const { ClassBreakRenderer } = Zondy.Renderer
const { SimpleFillSymbol,SimpleLineSymbol } = Zondy.Symbol
const { Color } = Zondy
// ES6引入方式
import { ArcGISVectorTileLayer,ClassBreakRenderer ,SimpleFillSymbol,SimpleLineSymbol,Color} from "@mapgis/webclient-commo
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer'
});
map.add(igsVectorTileLayer);
// 根据id获取子图层
const subLayer = igsVectorTileLayer.findSublayerById('子图层id')
// 设置渲染样式-分段专题图
subLayer.renderer = new ClassBreakRenderer({
    // 专题图过滤字段名
    field: '你的字段名',
    // 默认样式,当没有匹配到指定值时,会使用默认样式
    // 因为该数据的几何类型为区,因此设置区样式
    defaultSymbol:  new SimpleFillSymbol({
      // 填充颜色
      color: 'rgba(222,1,252,1)',
      // 线符号样式
      outline: new SimpleLineSymbol({
        //线符号颜色
        color: new Color(255, 1, 0, 1),
        //线宽
        width: 1
      })
    }),
    //分段专题图过滤条件数组
    classBreakInfos: [{
      // 最大过滤范围,field对应的值小于maxValue
      maxValue: "最大范围",
      // 最小过滤范围,field对应的值大于等于minValue
      minValue: "最小范围",
      // 匹配到该值后的样式
      // 因为该数据的几何类型为区,因此设置区样式
      symbol:  new SimpleFillSymbol({
        // 填充颜色
        color: 'rgba(1,1,252,1)',
        // 线符号样式
        outline: new SimpleLineSymbol({
          //线符号颜色
          color: new Color(255, 1, 0, 1),
          //线宽
          width: 1
        })
      })
    }]
  })

统一专题图

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
const { SimpleRenderer } = Zondy.Renderer
const { SimpleFillSymbol,SimpleLineSymbol } = Zondy.Symbol
const { Color } = Zondy
// ES6引入方式
import { ArcGISVectorTileLayer,SimpleRenderer ,SimpleFillSymbol,SimpleLineSymbol,Color} from "@mapgis/webclient-commo
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址,当不指定图层名称时,默认查询第一个子图层
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer',
  // 设置渲染样式-统一专题图
  renderer: new SimpleRenderer({
    // 因为该数据的几何类型为区,因此设置区样式
    symbol: new SimpleFillSymbol({
      // 填充颜色
      color: new Zondy.Color(255, 0, 0),
      // 外边线样式
      outline: new SimpleLineSymbol({
        // 线颜色
        color: new Color(0, 0, 0),
        // 线宽度
        width: 1
      })
    })
  })
})

继承关系

成员变量

Array.<String>

# capabilities

服务支持的能力

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 447

String

# labelsRenderMode

指定矢量瓦片注记的渲染模式(目前仅支持三维上矢量瓦片注记的渲染)

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 461

LoadStatus

# readonly loadStatus

图层加载状态

Default Value:
  • not-loaded

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 454

TileInfo | undefined

# readonly tileInfo

图层信息

Inherited From:

查看源代码 common/document/layer/baseLayer/VectorTileLayer.js, line 42

方法

# static fromJSON(jsonopt)

通过传入的json构造并返回一个新的几何对象

参数:

名称 类型 描述
json Object

JSON对象

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 1109

示例

通过传入的json构造并返回一个新的几何对象

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
// ES6引入方式
import { ArcGISVectorTileLayer } from "@mapgis/webclient-common"
const json = {
  // 服务基地址
  url: 'http://{ip}:{port}/igs/rest/services/Tile/{serviceName}/TileServer'
}
const igsVectorTileLayer = new ArcGISVectorTileLayer.fromJSON(json)

# clone()

克隆方法

Inherited From:

查看源代码 common/document/layer/baseLayer/VectorTileLayer.js, line 69

图层

Layer

# findSublayerById(sublayerID)

根据子图层id查询图层

参数:

名称 类型 描述
sublayerID String

图层ID

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 792

子图层

示例

根据子图层id查询图层

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
// ES6引入方式
import { ArcGISVectorTileLayer} from "@mapgis/webclient-common"
const igsVectorTileLayer = new ArcGISVectorTileLayer({
  // 服务基地址
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer'
});
map.add(igsVectorTileLayer);
// 根据id获取子图层
const subLayer = igsVectorTileLayer.findSublayerById('子图层id')

# getStyleLayer(layerId)

参数:

名称 类型 描述
layerId String

图层id

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 905

图层对象。可以查看矢量瓦片json中layers属性对图层的定义或者查看mvt style文件标准。

Object | null

# getStyleLayerVisible(layerId)

获取图层可见性

参数:

名称 类型 描述
layerId String

图层id

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 987

图层可见性状态

Boolean

# loadStyle()

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 1091

返回mvtStyle

Promise.<Object>
示例

获取矢量瓦片样式

// ES5引入方式
const { ArcGISVectorTileLayer } = Zondy.Layer
// ES6引入方式
import { ArcGISVectorTileLayer} from "@mapgis/webclient-common"
const igsVectorTileLayer = new ArcGISVectorTileLayer.({
  // 服务基地址
  url: 'http://{ip}:{port}/igs/rest/services/VectorTile/{serviceName}/VectorTileServer'
});
const style=igsVectorTileLayer.loadStyle()

# toJSON()

转换为json对象

Overrides:

查看源代码 common/document/layer/arcgis/ArcGISVectorTileLayer.js, line 1121

json对象

Object
构造函数
成员变量
方法
事件