class
WMSLayer
extends LayerBase
OGC WMS layer with GetCapabilities auto-detection, GetMap tile loading, and GetFeatureInfo queries.
Constructor
new WMSLayer(options: WMSLayerOptions) | Parameter | Type | Description | |
|---|---|---|---|
options | WMSLayerOptions | required | WMS layer configuration |
WMSLayerOptions
| Field | Type | Description | |
|---|---|---|---|
id | string | optional | Layer ID |
url | string | required | WMS service URL |
layers | string[] | required | Layer names to display |
format | string | optional | Image format Default: 'image/png' |
transparent | boolean | optional | Transparent background Default: true |
crs | string | optional | Coordinate reference system |
proxyUrl | string | optional | Proxy URL prefix for CORS |
vendorParams | Record<string, string> | optional | Extra WMS vendor parameters |
adapter | IMapImageryAdapter | optional | Injected adapter |
visible | boolean | optional | Initial visibility Default: true |
opacity | number | optional | Layer opacity (0-1) Default: 1 |
Properties
| Name | Type | Access | Description |
|---|---|---|---|
type | 'wms' | readonly | Layer type discriminant |
url | string | readonly | WMS service URL |
layerNames | string[] | readonly | Visible layer names |
format | string | readonly | Image format |
transparent | boolean | readonly | Transparency flag |
Methods
getTileUrl()
getTileUrl(extent: Extent, width: number, height: number): string Generate GetMap URL for a given extent.
Returns
string getFeatureInfo()
getFeatureInfo(x: number, y: number, extent: Extent, width: number, height: number): Promise<FeatureInfoResult> Query feature info at pixel position.
Returns
Promise<FeatureInfoResult> getLayerInfos()
getLayerInfos(): readonly MapImageryLayerInfo[] Get capabilities metadata.
Returns
readonly MapImageryLayerInfo[] Example
const wmsLayer = new WMSLayer({
url: 'https://ows.mundialis.de/services/service',
layers: ['TOPO-OSM-WMS'],
format: 'image/png',
transparent: true,
});
view.map.add(wmsLayer);