类名 WebMapServiceLayer

# new WebMapServiceLayer(url, options)

WMS服务接入类

参数:

名称 类型 默认值 描述
url String

服务基地址
IGS1.0: http://{ip}:{port}/igs/rest/ogc/doc/{folder}:{serviceName}/WMSServer
IGS2.0: http://{ip}:{port}/igs/rest/services/{folder}/{serviceName}/WMSServer

options Object

额外构造参数

layers String null

要显示的子图层

imageFormat String image/jpeg

图片格式

version String '1.1.1'

wms版本号

visible Boolean true

图层显隐

opacity Number 1

图层透明度

noWrap Boolean true

只显示一个图层,不平铺显示

tileSize Number 256

瓦片大小

transparent Boolean false

图片背景是否透明

bounds L.latLngBounds null

图层显示范围

clippingArea Object null

图层几何裁剪对象

isReverseBBOX Boolean false

是否反转坐标点顺序

tokenKey String 'token'

token名

tokenValue String null

token值

style String null

图层样式

headers Object null

请求头参数

示例

混合开发模式

// ES5引入方式
const { WMSLayer } = zondy.Layer
const { initializeCRS, initializeOptions } = zondy.leaflet
// ES6引入方式
import { WMSLayer } from "@mapgis/webclient-common"
import "@mapgis/webclient-leaflet-plugin"
const { initializeCRS, initializeOptions } = zondy.leaflet

// 构造一个WMSLayer图层对象
const layer = new WMSLayer({
  // 服务基地址
  url: "http://{ip}:{port}/igs/rest/services/{服务名}/WMSServer"
});
// 加载图层元数据
layer.load().then(function () {
  // 构造地图视图的初始化参数
  const crs = initializeCRS(layer)
  const mapViewOptions = {
    // 地图视图参考系
    crs: crs,
    // 初始化中心点
    center: [31.147781205532336,112.21905099757561],
    // 初始化级数
    zoom: 2
  }
  // 构造Leaflet地图视图对象
  const map = L.map('地图视图容器ID', mapViewOptions)
  // 构造图层的初始化参数
  const layerOptions = initializeOptions(layer)
  // 添加图层到地图视图中
  new zondy.leaflet.WebMapServiceLayer(layer.url, layerOptions).addTo(map)
})
构造函数
成员变量
方法
事件