Module: ol/source/wms

ol/source/wms


Functions

import {createLoader} from 'ol/source/wms';

Creates a loader for WMS images.

Name Type Description
crossOrigin null | string | undefined

The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.

hidpi boolean (defaults to true)

Use the ol/Map#pixelRatio value when requesting the image from the remote server.

params Object.<string, *> | undefined

WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT and BBOX will be set dynamically. CRS (SRS for WMS version < 1.3.0) will is derived from the proection config.

projection ProjectionLike | undefined

Projection. Default is 'EPSG:3857'.

ratio number (defaults to 1.5)

Ratio. 1 means image requests are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher.

serverType ServerType | undefined

The type of the remote WMS server: mapserver, geoserver, carmentaserver, or qgis. Only needed if hidpi is true.

url string

WMS service URL.

load function | undefined

Function to perform loading of the image. Receives the created HTMLImageElement and the desired src as argument and returns a promise resolving to the loaded or decoded image. Default is decode.

Returns:
Loader.

Type Definitions

LoaderOptions{Object}

Properties:
Name Type Description
crossOrigin null | string | undefined

The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you want to access pixel data with the Canvas renderer. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image for more detail.

hidpi boolean
(defaults to true)

Use the ol/Map#pixelRatio value when requesting the image from the remote server.

params Object.<string, *> | undefined

WMS request parameters. At least a LAYERS param is required. STYLES is '' by default. VERSION is 1.3.0 by default. WIDTH, HEIGHT and BBOX will be set dynamically. CRS (SRS for WMS version < 1.3.0) will is derived from the proection config.

projection ProjectionLike | undefined

Projection. Default is 'EPSG:3857'.

ratio number
(defaults to 1.5)

Ratio. 1 means image requests are the size of the map viewport, 2 means twice the width and height of the map viewport, and so on. Must be 1 or higher.

serverType ServerType | undefined

The type of the remote WMS server: mapserver, geoserver, carmentaserver, or qgis. Only needed if hidpi is true.

url string

WMS service URL.

load function | undefined

Function to perform loading of the image. Receives the created HTMLImageElement and the desired src as argument and returns a promise resolving to the loaded or decoded image. Default is decode.

ServerType{'carmentaserver'} {'geoserver'} {'mapserver'} {'qgis'}

Set the server type to use implementation-specific parameters beyond the WMS specification.