Class: ImageWMS

ol/source/ImageWMS~ImageWMS


import ImageWMS from 'ol/source/ImageWMS.js';

提供单个非瓦片图像的 WMS 服务器的数据源。

new ImageWMS(options)

Name Type Description
attributions AttributionLike | undefined

归属信息。

crossOrigin null | string | undefined 已加载图像的 crossOrigin 属性。注意如果要使用 Canvas 渲染器访问像素数据,必须提供 crossOrigin 值。详见 https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image。
referrerPolicy ReferrerPolicy | undefined

已加载图像的 referrerPolicy 属性。

hidpi boolean (defaults to true)

从远程服务器请求图像时使用 ol/Map#pixelRatio 值。

serverType ServerType | undefined 远程 WMS 服务器的类型:mapserver、geoserver、carmentaserver 或 qgis。仅在 hidpi 为 true 时需要。
imageLoad函数 Load函数 | undefined

给定 URL 加载图像的可选函数。

interpolate boolean (defaults to true)

重采样时是否使用插值。默认情况下, 重采样时使用线性插值。设置为 false 可使用 the nearest neighbor instead.

params 对象。<string, *> | undefined

WMS 请求参数。至少需要 LAYERS 参数。STYLES 默认为 ''VERSION 默认为 1.3.0WIDTHHEIGHTBBOXCRS(WMS 版本 < 1.3.0 时为 SRS)将动态设置。

projection ProjectionLike | undefined

投影。默认为视图投影。

ratio number (defaults to 1.5)

比率。1 表示图像请求为地图视口的大小,2 表示地图视口宽高的两倍,以此类推。必须为 1 或更高。

resolutions Array.<number> | undefined

分辨率列表。 如果指定,则仅对这些分辨率发起请求。

url string | undefined

WMS 服务 URL。

触发事件:

Extends

Methods

dispatchEvent(event){boolean | undefined} inherited

分发事件并调用所有监听此类型事件的监听器。事件参数可以是一个字符串或一个 具有 type 属性的对象。

Name Type Description
event BaseEvent | string

事件对象。

返回值:
如果有人在事件对象上调用了 preventDefault 或任何监听器返回 false,则返回 false

获取一个值。

Name Type Description
key string

键名。

返回值:
值。

获取数据源的归属函数。

返回值:
Attribution function.

getAttributionsCollapsible(){boolean} inherited

返回值:
归属信息是否可折叠。

get要素InfoUrl(coordinate, resolution, projection, params){string | undefined}

返回GetFeatureInfo URL for the passed coordinate, resolution, and projection. Return undefined if the GetFeatureInfo URL cannot be constructed.

Name Type Description
coordinate Coordinate

坐标。

resolution number

分辨率。

projection ProjectionLike

投影。

params Object

GetFeatureInfo 参数。至少应提供 INFO_FORMAT。如果未提供 QUERY_LAYERS,则使用 LAYERS 参数中指定的图层。此处不应指定 VERSION

返回值:
GetFeatureInfo URL.

getImageLoad函数(){Load函数}

返回image load function of the source.

返回值:
The image load function.

getKeys(){Array.<string>} inherited

获取对象属性名列表。

返回值:
属性名列表。

getLegendUrl(resolution, params){string | undefined}

返回 GetLegendGraphic URL,可选择针对指定分辨率进行优化,并可能包含任何传入的特定参数。如果无法构造 GetLegendGraphic URL 则返回 undefined。

Name Type Description
resolution number | undefined

分辨率。如果设置为 undefined,SCALE 将不会被计算并包含在 URL 中。

params Object | undefined

GetLegendGraphic 参数。如果设置了 LAYER,则为此 WMS 图层生成请求,否则将尝试使用已配置的 WMS 图层。默认 FORMATimage/png。此处不应指定 VERSION

返回值:
GetLegendGraphic URL.

getParams(){Object}

获取用户提供的参数,即通过"params"选项传递给构造函数的参数,可能已通过 updateParams 方法更新。

返回值:
参数。

getProjection(){Projection | null} inherited

获取数据源的投影。

返回值:
投影。

getProperties(){NoInfer.<Properties>} inherited

获取包含所有属性名和值的对象。

返回值:
对象。

getRevision(){number} inherited

获取此对象的版本号。 每次对象被修改时,其版本号将递增。

返回值:
版本号。

获取数据源的状态,可能的状态参见 State。

返回值:
状态。

getUrl(){string | undefined}

返回此 WMS 数据源使用的 URL。

返回值:
URL.

on(type, listener){EventsKey | Array<EventsKey>} inherited

监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

once(type, listener){EventsKey | Array<EventsKey>} inherited

仅监听一次特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

返回值:
监听器的唯一键。如果第一个参数是事件类型数组,则返回键的数组。

刷新数据源。数据源将被清除,并从服务器重新加载数据。

set(key, value, silent) inherited

设置一个值。

Name Type Description
key string

键名。

value *

值。

silent boolean | undefined

更新但不触发事件。

setAttributions(attributions) inherited

设置数据源的归属信息。

Name Type Description
attributions AttributionLike | undefined

归属信息。可以作为字符串、Array<string>、Attribution 或 undefined 传入。

setImageLoad函数(imageLoad函数)

设置image load function of the source.

Name Type Description
imageLoad函数 Load函数

图像加载函数。

setParams(params)

设置用户提供的参数。

Name Type Description
params Object

参数。

setProperties(values, silent) inherited

设置一组键值对。 注意,这会更改任何现有属性并添加新属性(不会移除任何现有属性)。

Name Type Description
values Partial.<NoInfer.<Properties>>

值。

silent boolean | undefined

更新但不触发事件。

设置用于请求的 URL。

Name Type Description
url string | undefined

URL.

un(type, listener) inherited

取消监听特定类型的事件。

Name Type Description
type string | Array.<string>

事件类型或事件类型数组。

listener function

监听器函数。

unset(key, silent) inherited

取消设置一个属性。

Name Type Description
key string

键名。

silent boolean | undefined

取消设置但不触发事件。

updateParams(params)

更新用户提供的参数。

Name Type Description
params Object

参数。