new WebMapTileServiceImageryProvider()
请参考以下示例:
1、添加一个WMTS图层:原生接口开发2、添加一个WMTS图层:混合接口开发
3、影像图层高程模式设置
4、卷帘
5、天地图
6、地表透明度独立控制
7、更多图层加载示例
支持如下方法:
[1、通过WMTS服务的url初始化WebMapTileServiceImageryProvider对象]WMTS服务接入类,现已不支持通过构造函数(new WebMapTileServiceImageryProvider())的方式初始化图层,而是使用fromUrl方法构造图层
Examples
// 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()
// 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)
})
Methods
-
WebMapTileServiceImageryProvider.fromUrl(url, options){Cesium.WebMapTileServiceImageryProvider}
engineExtensions/scene/imageryProvider/WebMapTileServiceImageryProvider.js, line 117 -
通过WMTS服务的url初始化WebMapTileServiceImageryProvider对象
Name Type Description urlCesium.Resource | String 服务的基地址,支持url字符串和Cesium.Resource两种类型,当类型为Cesium.Resource时,支持传入额外请求参数、请求头参数等,具体请参考Cesium.Resource
格式如下:
IGS1.0: http://{ip}:{port}/igs/rest/ogc/{folder}:{serviceName}/WMTSServer
IGS2.0: http://{ip}:{port}/igs/rest/services/{folder}/{serviceName}/WMTSServeroptionsObject 实例化对象时提供的额外配置参数,若该对象中包含构造参数则会覆盖对应的构造参数
Name Type Default Description layerstring null 可选 要显示的子图层名称
stylestring null 可选 要显示的子图层样式
formatstring 'image/jpeg' 可选 出图格式
tileMatrixSetIDstring null 可选 WMTS中要显示的子图层使用的矩阵集ID
tileMatrixLabelsArray [] 可选 矩阵ID数组,定义了哪些级别的瓦片可以被请求,不设置该数组,表示请求所有可请求的级别,设置该数组,则仅有级别在该数组中的瓦片可以被请求
tileWidthnumber 256 可选 请求瓦片宽度
tileHeightnumber 256 可选 请求瓦片高度
tilingSchemeCesium.TilingScheme | CustomTilingScheme Cesium.WebMercatorTilingScheme 可选 瓦片平铺方案,详见Cesium.TilingScheme
rectangleCesium.Rectangle Rectangle.MAX_VALUE 可选 图层显示范围,超出范围不会额外请求瓦片,详见Cesium.Rectangle
minimumLevelnumber 0 可选 图层最小请求瓦片级别,小于该级别不再请求瓦片
maximumLevelnumber 可选 图层最大请求瓦片级别,大于该级别不再请求瓦片
isStretchImageBoolean true 可选 “视图的显示级别,超出瓦片数据自身支持的级别”时,是否对瓦片进行拉伸显示。此值未定义或者设置为true时,超出范围后,会采用最接近一级的瓦片进行拉伸或缩放显示。反之,超出范围后,瓦片不再显示
ellipsoidCesium.Ellipsoid Cesium.Ellipsoid.default 可选 椭球体对象,详见Cesium.Ellipsoid
creditCesium.Credit | string null 可选 场景上显示的数据源的信息,当使用MapGIS发布的Cesium库时,该功能失效,详见Cesium.Credit
subdomainsstring | 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.clockCesium.Clock null 可选 A Clock instance that is used when determining the value for the time dimension. Required when
timesis specified.,详见Cesium.ClocktimesCesium.TimeIntervalCollection null 可选 TimeIntervalCollection with its
dataproperty being an object containing time dynamic dimension and their values.,详见Cesium.TimeIntervalCollectiondimensionsobject null 可选 A object containing static dimensions and their values.
isReverseXYBoolean null 可选 是否翻转出图范围bbox参数的x、y坐标。默认为null,程序会根据已知服务发布厂商的规则计算该值,如果用户设置了该值则以用户设置的为准。
versionString '1.1.1' 可选 WMTS服务版本号
Returns:
Type Description Cesium.WebMapTileServiceImageryProvider 初始化完毕后的WebMapTileServiceImageryProvider对象,详见Cesium.WebMapTileServiceImageryProvider Example
通过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)