类名 WebMapTileServiceImageryProvider

# new WebMapTileServiceImageryProvider()

WMTS图层,现已不支持通过构造函数(new WebMapTileServiceImageryProvider())的方式初始化图层,而是使用fromUrl方法构造图层

请参考以下示例:
1、添加一个WMTS图层:原生接口开发
2、添加一个WMTS图层:混合接口开发
3、影像图层高程模式设置
4、卷帘
5、天地图
6、地表透明度独立控制
7、更多图层加载示例
支持如下方法:
[1、通过WMTS服务的url初始化WebMapTileServiceImageryProvider对象]

示例

添加一个WMTS图层:原生接口开发

// ES5引入方式
const { WebMapTileServiceImageryProvider } = zondy.cesium
// ES6引入方式
import { WebMapTileServiceImageryProvider } from "@mapgis/webclient-cesium-plugin"

// 定义WMTS图层服务的基地址
const url = 'http://webclient.smaryun.com:8089/igs/rest/services/Tile/HuBei_4326/WMTSServer'

// 添加WMTS图层
async function addWMTSLayer() {
  const provider = await WebMapTileServiceImageryProvider.fromUrl(url)
  viewer.imageryLayers.addImageryProvider(provider)
}
// 添加WMTS图层
addWMTSLayer()

添加一个WMTS图层:混合接口开发

// ES5引入方式
const { WMTSLayer } = zondy.layer
const { initializeOptions } = zondy.cesium.util
// ES6引入方式
import { initializeOptions } from "@mapgis/webclient-cesium-plugin"
import { WMSLayer } from "@mapgis/webclient-common"

// 定义WMTS图层服务的基地址
const url = 'http://webclient.smaryun.com:8089/igs/rest/services/Tile/HuBei_4326/WMTSServer'

// 创建WMTS图层对象
const wmtsLayer = new WMTSLayer({
  url: url
})

// 获取WMTS图层服务的元信息
wmtsLayer.load().then((layer) => {
  // 获取provider的初始化参数
  const options = initializeOptions(layer, viewer)
  // 构造provider对象
  provider = new Cesium.WebMapTileServiceImageryProvider(options)
  // 添加图层到Cesium视图中
  cesiumLayer = viewer.imageryLayers.addImageryProvider(provider)
})

方法

# async static fromUrl(url, options)

通过WMTS服务的url初始化WebMapTileServiceImageryProvider对象

参数:

名称 类型 默认值 描述
url String

服务的基地址,无标准格式

options Object

实例化对象时提供的额外配置参数,若该对象中包含构造参数则会覆盖对应的构造参数

layer string null

要显示的子图层名称

style string null

要显示的子图层样式

format string 'image/jpeg'

出图格式

tileMatrixSetID string null

WMTS中要显示的子图层使用的矩阵集ID

tileMatrixLabels Array []

矩阵ID数组,定义了哪些级别的瓦片可以被请求,不设置该数组,表示请求所有可请求的级别,设置该数组,则仅有级别在该数组中的瓦片可以被请求

tileWidth number 256

请求瓦片宽度

tileHeight number 256

请求瓦片高度

tilingScheme Cesium.TilingScheme | CustomTilingScheme Cesium.WebMercatorTilingScheme

瓦片平铺方案,详见Cesium.TilingScheme

rectangle Cesium.Rectangle Rectangle.MAX_VALUE

图层显示范围,超出范围不会额外请求瓦片,详见Cesium.Rectangle

minimumLevel number 0

图层最小请求瓦片级别,小于该级别不再请求瓦片

maximumLevel number

图层最大请求瓦片级别,大于该级别不再请求瓦片

isStretchImage Boolean false

超过最大最小层级范围图像是否进行图像的拉伸。此值未定义或者设置为true时,如果图像level小于minimumLevel或者大于maximumLevel,图像会进行拉伸。反之,如果图像level小于minimumLevel或者大于maximumLevel,不会再请求图像以及拉伸图像

ellipsoid Cesium.Ellipsoid Cesium.Ellipsoid.default

椭球体对象,详见Cesium.Ellipsoid

credit Cesium.Credit | string null

场景上显示的数据源的信息,当使用MapGIS发布的Cesium库时,该功能失效,详见Cesium.Credit

subdomains string | Array.<string> 'abc'

The subdomains to use for the {s} placeholder in the URL template. If this parameter is a single string, each character in the string is a subdomain. If it is an array, each element in the array is a subdomain.

clock Cesium.Clock null

A Clock instance that is used when determining the value for the time dimension. Required when times is specified.,详见Cesium.Clock

times Cesium.TimeIntervalCollection null

TimeIntervalCollection with its data property being an object containing time dynamic dimension and their values.,详见Cesium.TimeIntervalCollection

dimensions object null

A object containing static dimensions and their values.

初始化完毕后的WebMapTileServiceImageryProvider对象,详见Cesium.WebMapTileServiceImageryProvider

Cesium.WebMapTileServiceImageryProvider
示例

通过WMTS服务的url获取WebMapTileServiceImageryProvider对象

// ES5引入方式
const { WebMapTileServiceImageryProvider } = zondy.cesium
// ES6引入方式
import { WebMapTileServiceImageryProvider } from "@mapgis/webclient-cesium-plugin"

const url = 'http://localhost:8089/igs/rest/services/Map/example/WMTSServer'
const addImageryProvider = async (url) => {
  const imageryProvider = await WebMapTileServiceImageryProvider.fromUrl(url)
  viewer.imageryLayers.addImageryProvider(imageryProvider)
}
addImageryProvider(url)
构造函数
成员变量
方法
事件