-
Name Type Description extent
Extent | undefined Extent for the tile grid. No tiles outside this extent will be requested by
TileSource
sources. When noorigin
ororigins
are configured, theorigin
will be set to the top-left corner of the extent.origin
Coordinate | undefined The tile grid origin, i.e. where the
x
andy
axes meet ([z, 0, 0]
). Tile coordinates increase left to right and downwards. If not specified,extent
ororigins
must be provided.origins
Array<Coordinate> | undefined Tile grid origins, i.e. where the
x
andy
axes meet ([z, 0, 0]
), for each zoom level. If given, the array length should match the length of theresolutions
array, i.e. each resolution can have a different origin. Tile coordinates increase left to right and downwards. If not specified,extent
ororigin
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 ofmaxZoom + 1
matrixIds
Array.<string> matrix IDs. The length of this array needs to match the length of the
resolutions
array.sizes
Array<Size> | undefined Number of tile rows and columns of the grid for each zoom level. The values here are the
TileMatrixWidth
andTileMatrixHeight
advertised in the GetCapabilities response of the WMTS, and define each zoom level's extent together with theorigin
ororigins
. A gridextent
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 an extent is used asorigin
ororigins
, then they
value must be negative because OpenLayers tile coordinates use the top left as the origin.tileSize
number | Size | undefined Tile size.
tileSizes
Array.<(number|module:ol/size~Size)> | undefined Tile sizes. The length of this array needs to match the length of the
resolutions
array.
Extends
Methods
-
Call a function with each tile coordinate for a given extent and zoom level.
Name Type Description extent
Extent Extent.
zoom
number Integer zoom level.
callback
function Function called with each tile coordinate.
-
Get the extent for this tile grid, if it was configured.
Returns:
Extent.
-
Get the list of matrix identifiers.
Returns:
MatrixIds.
-
Get the maximum zoom level for the grid.
Returns:
Max zoom.
-
Get the minimum zoom level for the grid.
Returns:
Min zoom.
-
Get the origin for the grid at the given zoom level.
Name Type Description z
number Integer zoom level.
Returns:
Origin.
-
Get the resolution for the given zoom level.
Name Type Description z
number Integer zoom level.
Returns:
Resolution.
-
Get the list of resolutions for the tile grid.
Returns:
Resolutions.
-
Get the extent of a tile coordinate.
Name Type Description tileCoord
TileCoord Tile coordinate.
tempExtent
Extent | undefined Temporary extent object.
Returns:
Extent.
-
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
Coordinate Coordinate.
resolution
number Resolution.
opt_tileCoord
TileCoord | undefined Destination module:ol/tilecoord~TileCoord object.
Returns:
Tile coordinate.
-
Get a tile coordinate given a map coordinate and zoom level.
Name Type Description coordinate
Coordinate Coordinate.
z
number Zoom level.
opt_tileCoord
TileCoord | undefined Destination module:ol/tilecoord~TileCoord object.
Returns:
Tile coordinate.
-
Get the tile size for a zoom level. The type of the return value matches the
tileSize
ortileSizes
that the tile grid was configured with. To always get anSize
, run the result throughtoSize
.Name Type Description z
number Z.
Returns:
Tile size.
-
Name Type Description resolution
number Resolution.
opt_direction
number | NearestDirectionFunction | undefined If 0, the nearest resolution will be used. If 1, the nearest higher resolution (lower Z) will be used. If -1, the nearest lower resolution (higher Z) will be used. Default is 0. Use a
NearestDirectionFunction
for more precise control.For example to change tile Z at the midpoint of zoom levels
function(value, high, low) { return value - low * Math.sqrt(high / low); }
Returns:
Z.