Class: TileWMS


import TileWMS from 'ol/source/TileWMS';

Layer source for tile data from WMS servers.

new TileWMS(opt_options)

source/TileWMS.js, line 79
Name Type Description

Tile WMS options.

Name Type Default Description
attributions module:ol/source/Source~AttributionLike


cacheSize number 2048

Cache size.

crossOrigin null | string

The crossOrigin attribute for loaded images. Note that you must provide a crossOrigin value if you are using the WebGL renderer or if you want to access pixel data with the Canvas renderer. See for more detail.

params Object.<string, *>

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

gutter number 0

The size in pixels of the gutter around image tiles to ignore. By setting this property to a non-zero value, images will be requested that are wider and taller than the tile size by a value of 2 x gutter. Using a non-zero value allows artifacts of rendering at tile edges to be ignored. If you control the WMS service it is recommended to address "artifacts at tile edges" issues by properly configuring the WMS service. For example, MapServer has a tile_map_edge_buffer configuration parameter for this. See

hidpi boolean true

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

projection module:ol/proj~ProjectionLike


reprojectionErrorThreshold number 0.5

Maximum allowed reprojection error (in pixels). Higher values can increase reprojection performance, but decrease precision.

tileClass Class.<module:ol/ImageTile~ImageTile>

Class used to instantiate image tiles. Default is module:ol/ImageTile~ImageTile.

tileGrid module:ol/tilegrid/TileGrid~TileGrid

Tile grid. Base this on the resolutions, tilesize and extent supported by the server. If this is not defined, a default grid will be used: if there is a projection extent, the grid will be based on that; if not, a grid based on a global extent with origin at 0,0 will be used..

serverType module:ol/source/WMSServerType | string

The type of the remote WMS server. Currently only used when hidpi is true.

tileLoadFunction module:ol/Tile~LoadFunction

Optional function to load a tile given a URL. The default is

function(imageTile, src) {
  imageTile.getImage().src = src;
url string

WMS service URL.

urls Array.<string>

WMS service urls. Use this instead of url when the WMS supports multiple urls for GetMap requests.

wrapX boolean true

Whether to wrap the world horizontally. When set to false, only one world will be rendered. When true, tiles will be requested for one world only, but they will be wrapped horizontally to render multiple worlds.

transition number

Duration of the opacity transition for rendering. To disable the opacity transition, pass transition: 0.




getGetFeatureInfoUrl(coordinate, resolution, projection, params){string|undefined}

source/TileWMS.js, line 163

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

Name Type Description
coordinate module:ol/coordinate~Coordinate


resolution number


projection module:ol/proj~ProjectionLike


params Object

GetFeatureInfo params. INFO_FORMAT at least should be provided. If QUERY_LAYERS is not provided then the layers specified in the LAYERS parameter will be used. VERSION should not be specified here.

GetFeatureInfo URL.


source/TileWMS.js, line 228

Get the user-provided params, i.e. those passed to the constructor through the "params" option, and possibly updated using the updateParams method.


getTileLoadFunction(){module:ol/Tile~LoadFunction} inherited

source/UrlTile.js, line 104

Return the tile load function of the source.


getTileUrlFunction(){module:ol/Tile~UrlFunction} inherited

source/UrlTile.js, line 113

Return the tile URL function of the source.


getUrls(){!Array.<string>|null} inherited

source/UrlTile.js, line 124

Return the URLs used for this source. When a tileUrlFunction is used instead of url or urls, null will be returned.


setRenderReprojectionEdges(render) inherited

source/TileImage.js, line 356

Sets whether to render reprojection edges or not (usually for debugging).

Name Type Description
render boolean

Render the edges.

setTileGridForProjection(projection, tilegrid) inherited

source/TileImage.js, line 380

Sets the tile grid to use when reprojecting the tiles to the given projection instead of the default tile grid for the projection.

This can be useful when the default tile grid cannot be created (e.g. projection has no extent defined) or for optimization reasons (custom tile size, resolutions, ...).

Name Type Description
projection module:ol/proj~ProjectionLike


tilegrid module:ol/tilegrid/TileGrid~TileGrid

Tile grid to use for the projection.

setTileLoadFunction(tileLoadFunction) inherited

source/UrlTile.js, line 157

Set the tile load function of the source.

Name Type Description
tileLoadFunction module:ol/Tile~LoadFunction

Tile load function.

setTileUrlFunction(tileUrlFunction, key) inherited

source/UrlTile.js, line 169

Set the tile URL function of the source.

Name Type Description
tileUrlFunction module:ol/Tile~UrlFunction

Tile URL function.

key string

Optional new tile key for the source.

setUrl(url) inherited

source/UrlTile.js, line 184

Set the URL to use for requests.

Name Type Description
url string


setUrls(urls) inherited

source/UrlTile.js, line 194

Set the URLs to use for requests.

Name Type Description
urls Array.<string>



source/TileWMS.js, line 330

Update the user-provided params.

Name Type Description
params Object