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 acrossOrigin
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
is1.3.0
by default.WIDTH
,HEIGHT
andBBOX
will be set dynamically.CRS
(SRS
for WMS version < 1.3.0) will is derived from theproection
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 be1
or higher.serverType
ServerType | undefined The type of the remote WMS server:
mapserver
,geoserver
,carmentaserver
, orqgis
. Only needed ifhidpi
istrue
.url
string WMS service URL.
load
function | undefined Function to perform loading of the image. Receives the created
HTMLImageElement
and the desiredsrc
as argument and returns a promise resolving to the loaded or decoded image. Default isdecode
.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 acrossOrigin
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
is1.3.0
by default.WIDTH
,HEIGHT
andBBOX
will be set dynamically.CRS
(SRS
for WMS version < 1.3.0) will is derived from theproection
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 be1
or higher.serverType
ServerType | undefined The type of the remote WMS server:
mapserver
,geoserver
,carmentaserver
, orqgis
. Only needed ifhidpi
istrue
.url
string WMS service URL.
load
function | undefined Function to perform loading of the image. Receives the created
HTMLImageElement
and the desiredsrc
as argument and returns a promise resolving to the loaded or decoded image. Default isdecode
. -
ServerType{'carmentaserver'} {'geoserver'} {'mapserver'} {'qgis'}
-
Set the server type to use implementation-specific parameters beyond the WMS specification.
'carmentaserver'
: HiDPI support for Carmenta Server'geoserver'
: HiDPI support for GeoServer'mapserver'
: HiDPI support for MapServer'qgis'
: HiDPI support for QGIS