Class: WMTSTileGrid

ol/tilegrid/WMTS~WMTSTileGrid


import WMTSTileGrid from 'ol/tilegrid/WMTS';

Set the grid pattern for sources accessing WMTS tiled-image servers.

new WMTSTileGrid(options)

tilegrid/WMTS.js, line 57
Name Type Description
options

WMTS options.

Name Type Description
extent module:ol/extent~Extent

Extent for the tile grid. No tiles outside this extent will be requested by module:ol/source/Tile sources. When no origin or origins are configured, the origin will be set to the top-left corner of the extent.

origin module:ol/coordinate~Coordinate

The tile grid origin, i.e. where the x and y axes meet ([z, 0, 0]). Tile coordinates increase left to right and upwards. If not specified, extent or origins must be provided.

origins Array.<module:ol/coordinate~Coordinate>

Tile grid origins, i.e. where the x and y axes meet ([z, 0, 0]), for each zoom level. If given, the array length should match the length of the resolutions array, i.e. each resolution can have a different origin. Tile coordinates increase left to right and upwards. If not specified, extent or origin must be provided.

resolutions Array.<number>

Resolutions. The array index of each resolution needs to match the zoom level. This means that even if a minZoom is configured, the resolutions array will have a length of maxZoom + 1

matrixIds Array.<string>

matrix IDs. The length of this array needs to match the length of the resolutions array.

sizes Array.<module:ol/size~Size>

Number of tile rows and columns of the grid for each zoom level. The values here are the TileMatrixWidth and TileMatrixHeight advertised in the GetCapabilities response of the WMTS, and define the grid's extent together with the origin. An extent can be configured in addition, and will further limit the extent for which tile requests are made by sources. If the bottom-left corner of the extent is used as origin or origins, then the y value must be negative because OpenLayers tile coordinates use the top left as the origin.

tileSize number | module:ol/size~Size

Tile size.

tileSizes Array.<module:ol/size~Size>

Tile sizes. The length of this array needs to match the length of the resolutions array.

widths Array.<number>

Number of tile columns that cover the grid's extent for each zoom level. Only required when used with a source that has wrapX set to true, and only when the grid's origin differs from the one of the projection's extent. The array length has to match the length of the resolutions array, i.e. each resolution will have a matching entry here.

Extends

Methods

forEachTileCoord(extent, zoom, callback) inherited

tilegrid/TileGrid.js, line 195

Call a function with each tile coordinate for a given extent and zoom level.

Name Type Description
extent module:ol/extent~Extent

Extent.

zoom number

Integer zoom level.

callback function

Function called with each tile coordinate.

getExtent(){module:ol/extent~Extent} inherited

tilegrid/TileGrid.js, line 242

Get the extent for this tile grid, if it was configured.

Returns:
Extent.

getMatrixIds(){Array.<string>}

tilegrid/WMTS.js, line 88

Get the list of matrix identifiers.

Returns:
MatrixIds.

getMaxZoom(){number} inherited

tilegrid/TileGrid.js, line 251

Get the maximum zoom level for the grid.

Returns:
Max zoom.

getMinZoom(){number} inherited

tilegrid/TileGrid.js, line 260

Get the minimum zoom level for the grid.

Returns:
Min zoom.

getOrigin(z){module:ol/coordinate~Coordinate} inherited

tilegrid/TileGrid.js, line 270

Get the origin for the grid at the given zoom level.

Name Type Description
z number

Integer zoom level.

Returns:
Origin.

getResolution(z){number} inherited

tilegrid/TileGrid.js, line 284

Get the resolution for the given zoom level.

Name Type Description
z number

Integer zoom level.

Returns:
Resolution.

getResolutions(){Array.<number>} inherited

tilegrid/TileGrid.js, line 293

Get the list of resolutions for the tile grid.

Returns:
Resolutions.

getTileCoordExtent(tileCoord, opt_extent){module:ol/extent~Extent} inherited

tilegrid/TileGrid.js, line 373

Get the extent of a tile coordinate.

Name Type Description
tileCoord module:ol/tilecoord~TileCoord

Tile coordinate.

extent module:ol/extent~Extent

Temporary extent object.

Returns:
Extent.

getTileCoordForCoordAndResolution(coordinate, resolution, opt_tileCoord){module:ol/tilecoord~TileCoord} inherited

tilegrid/TileGrid.js, line 395

Get the tile coordinate for the given map coordinate and resolution. This method considers that coordinates that intersect tile boundaries should be assigned the higher tile coordinate.

Name Type Description
coordinate module:ol/coordinate~Coordinate

Coordinate.

resolution number

Resolution.

tileCoord module:ol/tilecoord~TileCoord

Destination module:ol/tilecoord~TileCoord object.

Returns:
Tile coordinate.

getTileCoordForCoordAndZ(coordinate, z, opt_tileCoord){module:ol/tilecoord~TileCoord} inherited

tilegrid/TileGrid.js, line 483

Get a tile coordinate given a map coordinate and zoom level.

Name Type Description
coordinate module:ol/coordinate~Coordinate

Coordinate.

z number

Zoom level.

tileCoord module:ol/tilecoord~TileCoord

Destination module:ol/tilecoord~TileCoord object.

Returns:
Tile coordinate.

getTileSize(z){number|module:ol/size~Size} inherited

tilegrid/TileGrid.js, line 504

Get the tile size for a zoom level. The type of the return value matches the tileSize or tileSizes that the tile grid was configured with. To always get an module:ol/size~Size, run the result through module:ol/size~Size.toSize().

Name Type Description
z number

Z.

Returns:
Tile size.

getZForResolution(resolution, opt_direction){number} inherited

tilegrid/TileGrid.js, line 532
Name Type Description
resolution number

Resolution.

direction number

If 0, the nearest resolution will be used. If 1, the nearest lower resolution will be used. If -1, the nearest higher resolution will be used. Default is 0.

Returns:
Z.