Class: QgsTileMatrix

class qgis.core.QgsTileMatrix

Bases: sip.wrapper

Defines a matrix of tiles for a single zoom level: it is defined by its size (width * brief height) and map extent that it covers.

Please note that we follow the XYZ convention of X/Y axes, i.e. top-left tile has [0,0] coordinate (which is different from TMS convention where bottom-left tile has [0,0] coordinate).

New in version 3.14:

Methods

crs

Returns the crs of the tile matrix.

extent

Returns extent of the tile matrix

fromCustomDef

Returns a tile matrix for a specific CRS, top left point, zoom level 0 dimension in CRS units.

fromTileMatrix

Returns a tile matrix based on another one

fromWebMercator

Returns a tile matrix for the usual web mercator

isRootTileMatrix

Returns the root status of the tile matrix (zoom level == 0)

mapToTileCoordinates

Returns row/column coordinates (floating point number) from the given point in map coordinates

matrixHeight

Returns number of rows of the tile matrix

matrixWidth

Returns number of columns of the tile matrix

scale

Returns scale denominator of the tile matrix.

setCrs

Sets the crs of the tile matrix.

setScale

Sets the scale denominator of the tile matrix.

setZoomLevel

Sets the zoom level of the tile matrix.

tileCenter

Returns center of the given tile in this matrix

tileExtent

Returns extent of the given tile in this matrix

tileRangeFromExtent

Returns tile range that fully covers the given extent

zoomLevel

Returns the zoom level of the tile matrix.

crs(self) QgsCoordinateReferenceSystem

Returns the crs of the tile matrix.

See also

setCrs()

Return type

QgsCoordinateReferenceSystem

extent(self) QgsRectangle

Returns extent of the tile matrix

Return type

QgsRectangle

fromCustomDef(zoomLevel: int, crs: QgsCoordinateReferenceSystem, z0TopLeftPoint: QgsPointXY, z0Dimension: float, z0MatrixWidth: int = 1, z0MatrixHeight: int = 1) QgsTileMatrix

Returns a tile matrix for a specific CRS, top left point, zoom level 0 dimension in CRS units.

The z0Dimension argument must specify the dimension (width or height, in map units) of the root tiles in zoom level 0.

Parameters
Return type

QgsTileMatrix

fromTileMatrix(zoomLevel: int, tileMatrix: QgsTileMatrix) QgsTileMatrix

Returns a tile matrix based on another one

Parameters
Return type

QgsTileMatrix

fromWebMercator(zoomLevel: int) QgsTileMatrix

Returns a tile matrix for the usual web mercator

Parameters

zoomLevel (int) –

Return type

QgsTileMatrix

isRootTileMatrix(self) bool

Returns the root status of the tile matrix (zoom level == 0)

Return type

bool

mapToTileCoordinates(self, mapPoint: QgsPointXY) QPointF

Returns row/column coordinates (floating point number) from the given point in map coordinates

Parameters

mapPoint (QgsPointXY) –

Return type

QPointF

matrixHeight(self) int

Returns number of rows of the tile matrix

Return type

int

matrixWidth(self) int

Returns number of columns of the tile matrix

Return type

int

scale(self) float

Returns scale denominator of the tile matrix.

See also

setScale()

Return type

float

setCrs(self, crs: QgsCoordinateReferenceSystem)

Sets the crs of the tile matrix.

See also

crs()

New in version 3.22.6.

Parameters

crs (QgsCoordinateReferenceSystem) –

setScale(self, scale: float)

Sets the scale denominator of the tile matrix.

See also

scale()

New in version 3.22.6.

Parameters

scale (float) –

setZoomLevel(self, level: int)

Sets the zoom level of the tile matrix.

See also

zoomLevel()

New in version 3.22.6.

Parameters

level (int) –

tileCenter(self, id: QgsTileXYZ) QgsPointXY

Returns center of the given tile in this matrix

Parameters

id (QgsTileXYZ) –

Return type

QgsPointXY

tileExtent(self, id: QgsTileXYZ) QgsRectangle

Returns extent of the given tile in this matrix

Parameters

id (QgsTileXYZ) –

Return type

QgsRectangle

tileRangeFromExtent(self, mExtent: QgsRectangle) QgsTileRange

Returns tile range that fully covers the given extent

Parameters

mExtent (QgsRectangle) –

Return type

QgsTileRange

zoomLevel(self) int

Returns the zoom level of the tile matrix.

See also

setZoomLevel()

Return type

int