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.
-
import {getFeatureInfoUrl} from 'ol/source/wms';
Get the GetFeatureInfo URL for the passed coordinate and resolution. Returns
undefined
if the GetFeatureInfo URL cannot be constructed.Name Type Description options
LoaderOptions Options passed the
createWMSLoader()
function. In addition to the params required by the loader,INFO_FORMAT
should be specified, it defaults toapplication/json
. IfQUERY_LAYERS
is not provided, then the layers specified in theLAYERS
parameter will be used.coordinate
Coordinate Coordinate.
resolution
number Resolution.
options.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.options.hidpi
boolean (defaults to true) Use the
ol/Map#pixelRatio
value when requesting the image from the remote server.options.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.options.projection
ProjectionLike | undefined Projection. Default is 'EPSG:3857'.
options.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.options.serverType
ServerType | undefined The type of the remote WMS server:
mapserver
,geoserver
,carmentaserver
, orqgis
. Only needed ifhidpi
istrue
.options.url
string WMS service URL.
options.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:
GetFeatureInfo URL.
-
import {getLegendUrl} from 'ol/source/wms';
Get the GetLegendGraphic URL, optionally optimized for the passed resolution and possibly including any passed specific parameters. Returns
undefined
if the GetLegendGraphic URL cannot be constructed.Name Type Description options
LoaderOptions Options passed the
createWMSLoader()
function.resolution
number | undefined Resolution. If not provided,
SCALE
will not be calculated and included in URL.options.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.options.hidpi
boolean (defaults to true) Use the
ol/Map#pixelRatio
value when requesting the image from the remote server.options.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.options.projection
ProjectionLike | undefined Projection. Default is 'EPSG:3857'.
options.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.options.serverType
ServerType | undefined The type of the remote WMS server:
mapserver
,geoserver
,carmentaserver
, orqgis
. Only needed ifhidpi
istrue
.options.url
string WMS service URL.
options.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:
GetLegendGraphic URL.
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