类名 WebMapServiceImageryProvider

# new WebMapServiceImageryProvider()

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

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

示例

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

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

// 定义WMS图层服务的基地址
const url = 'http://webclient.smaryun.com:8089/igs/rest/services/Map/湖北省4326/WMSServer'

// 添加WMS图层
async function addWMSLayer() {
  const provider = await WebMapServiceImageryProvider.fromUrl(url)
  viewer.imageryLayers.addImageryProvider(provider)
}
// 添加WMS图层
addWMSLayer(url)

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

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

// 定义WMS图层服务的基地址
const url = 'http://webclient.smaryun.com:8089/igs/rest/services/Map/湖北省4326/WMSServer'

// 创建WMS图层对象
const wmsLayer = new WMSLayer({
  url: url
})

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

方法

# async static fromUrl(url, options)

通过WMS服务的url获取WebMapServiceImageryProvider对象

参数:

名称 类型 默认值 描述
url String

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

options Object

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

layers string null

要显示的子图层id,多个子图层以逗号分隔,'layer1,layer2,...'

crs string null

坐标系名称(CRS),当WMS版本大于等于1.3.0时,使用该值

srs string null

坐标系名称(SRS),当WMS版本是1.1.0或者1.1.1时,使用该值

rectangle Cesium.Rectangle Rectangle.MAX_VALUE

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

tilingScheme Cesium.TilingScheme | CustomTilingScheme new Cesium.GeographicTilingScheme()

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

tileWidth number 256

请求瓦片宽度

tileHeight number 256

请求瓦片高度

minimumLevel number 0

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

maximumLevel number

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

ellipsoid Cesium.Ellipsoid Cesium.Ellipsoid.default

椭球体对象,详见Cesium.Ellipsoid

parameters object Cesium.WebMapServiceImageryProvider.DefaultParameters

额外要添加在出图请求中的参数

getFeatureInfoParameters object WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters

额外要添加在请求元信息链接中的参数

credit Cesium.Credit | string null

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

enablePickFeatures boolean true

If true, WebMapServiceImageryProvider#pickFeatures will invoke the GetFeatureInfo operation on the WMS server and return the features included in the response. If false, WebMapServiceImageryProvider#pickFeatures will immediately return undefined (indicating no pickable features) without communicating with the server. Set this property to false if you know your WMS server does not support GetFeatureInfo or if you don't want this provider's features to be pickable. Note that this can be dynamically overridden by modifying the WebMapServiceImageryProvider#enablePickFeatures property.

getFeatureInfoFormats Array.<Cesium.GetFeatureInfoFormat> Cesium.WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats

The formats in which to try WMS GetFeatureInfo requests. this parameter is ignored and the tiling scheme's ellipsoid is used instead. If neither parameter is specified, the WGS84 ellipsoid is used.

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

getFeatureInfoUrl Cesium.Resource | string

The getFeatureInfo URL of the WMS service. If the property is not defined then we use the property value of url.,详见Cesium.Resource

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

Cesium.WebMapServiceImageryProvider
示例

通过WMS服务的url获取WebMapServiceImageryProvider对象

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

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