Class: QgsTileMatrixSet¶
- class qgis.core.QgsTileMatrixSet¶
Bases:
sip.wrapper
Defines a set of tile matrices for multiple zoom levels.
New in version 3.22.6:
Methods
Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup.
Adds a
matrix
to the set.Calculates the correct scale to use for the tiles when rendered using the specified map properties.
Returns the coordinate reference system associated with the tiles.
Deletes any existing matrices which fall outside the zoom range specified by
minimumZoom
tomaximumZoom
, inclusive.Returns the maximum zoom level for tiles present in the set.
Returns the minimum zoom level for tiles present in the set.
Reads the set from an XML
element
.Calculates the correct scale to use for the tiles when rendered using the specified render
context
.Returns the scale to tile zoom method.
Calculates a fractional zoom level given a map
scale
denominator.Finds the best fitting (integer) zoom level given a map
scale
denominator.Sets the scale to tile zoom method.
Returns the tile matrix corresponding to the specified
zoom
.Writes the set to an XML element.
- addGoogleCrs84QuadTiles(self, minimumZoom: int = 0, maximumZoom: int = 14)¶
Adds tile matrices corresponding to the standard web mercator/GoogleCRS84Quad setup.
- Parameters
minimumZoom (int = 0) –
maximumZoom (int = 14) –
- addMatrix(self, matrix: QgsTileMatrix)¶
Adds a
matrix
to the set.Any existing matrix with the same
QgsTileMatrix.zoomLevel()
will be replaced.- Parameters
matrix (QgsTileMatrix) –
- calculateTileScaleForMap(self, actualMapScale: float, mapCrs: QgsCoordinateReferenceSystem, mapExtent: QgsRectangle, mapSize: QSize, mapDpi: float) float ¶
Calculates the correct scale to use for the tiles when rendered using the specified map properties.
New in version 3.26.
- Parameters
actualMapScale (float) –
mapCrs (QgsCoordinateReferenceSystem) –
mapExtent (QgsRectangle) –
mapSize (QSize) –
mapDpi (float) –
- Return type
float
- crs(self) QgsCoordinateReferenceSystem ¶
Returns the coordinate reference system associated with the tiles.
In the case of a tile set containing mixed CRS at different zoom levels this method will return the crs of the minimum zoom tile matrix.
- Return type
- dropMatricesOutsideZoomRange(self, minimumZoom: int, maximumZoom: int)¶
Deletes any existing matrices which fall outside the zoom range specified by
minimumZoom
tomaximumZoom
, inclusive.- Parameters
minimumZoom (int) –
maximumZoom (int) –
- maximumZoom(self) int ¶
Returns the maximum zoom level for tiles present in the set.
See also
- Return type
int
- minimumZoom(self) int ¶
Returns the minimum zoom level for tiles present in the set.
See also
- Return type
int
- readXml(self, element: QDomElement, context: QgsReadWriteContext) bool ¶
Reads the set from an XML
element
.See also
- Parameters
element (QDomElement) –
context (QgsReadWriteContext) –
- Return type
bool
- scaleForRenderContext(self, context: QgsRenderContext) float ¶
Calculates the correct scale to use for the tiles when rendered using the specified render
context
.New in version 3.26.
- Parameters
context (QgsRenderContext) –
- Return type
float
- scaleToTileZoomMethod(self) Qgis.ScaleToTileZoomLevelMethod ¶
Returns the scale to tile zoom method.
See also
- Return type
- scaleToZoom(self, scale: float) float ¶
Calculates a fractional zoom level given a map
scale
denominator.The zoom level will be linearly interpolated between zoom levels present in the set.
- Parameters
scale (float) –
- Return type
float
- scaleToZoomLevel(self, scale: float) int ¶
Finds the best fitting (integer) zoom level given a map
scale
denominator.Values are constrained to the zoom levels between
minimumZoom()
andmaximumZoom()
.- Parameters
scale (float) –
- Return type
int
- setScaleToTileZoomMethod(self, method: Qgis.ScaleToTileZoomLevelMethod)¶
Sets the scale to tile zoom method.
See also
- Parameters
method (Qgis.ScaleToTileZoomLevelMethod) –
- tileMatrix(self, zoom: int) QgsTileMatrix ¶
Returns the tile matrix corresponding to the specified
zoom
.- Parameters
zoom (int) –
- Return type
- writeXml(self, document: QDomDocument, context: QgsReadWriteContext) QDomElement ¶
Writes the set to an XML element.
- Parameters
document (QDomDocument) –
context (QgsReadWriteContext) –
- Return type
QDomElement