Class: QgsVtpkTiles

Utility class for reading and writing ESRI VTPK files.

Added in version 3.26.

class qgis.core.QgsVtpkTiles[source]

Bases: object

__init__(filename: str | None)

Constructs VTPK reader (but it does not open the file yet)

Parameters:

filename (Optional[str])

crs(self) QgsCoordinateReferenceSystem[source]

Returns the coordinate reference system of the tiles.

Return type:

QgsCoordinateReferenceSystem

extent(self, context: QgsCoordinateTransformContext) QgsRectangle[source]

Returns bounding box from metadata, given in the tiles crs().

Parameters:

context (QgsCoordinateTransformContext)

Return type:

QgsRectangle

isOpen(self) bool[source]

Returns whether the VTPK file is currently opened

Return type:

bool

layerMetadata(self) QgsLayerMetadata[source]

Reads layer metadata from the VTPK file.

Return type:

QgsLayerMetadata

matrixSet(self) QgsVectorTileMatrixSet[source]

Returns the vector tile matrix set representing the tiles.

Return type:

QgsVectorTileMatrixSet

metadata(self) Dict[str, Any][source]

Returns the VTPK metadata.

This method returns the contents of the “root.json” file.

Return type:

Dict[str, Any]

open(self) bool[source]

Tries to open the file, returns true on success

Return type:

bool

rootTileMap(self) Dict[str, Any][source]

Returns the root tilemap content, if it exists.

This method returns the contents of the “tilemap/root.json” file.

Added in version 3.32.

Return type:

Dict[str, Any]

spriteDefinition(self) Dict[str, Any][source]

Returns the VTPK sprites definitions.

Return type:

Dict[str, Any]

spriteImage(self) QImage[source]

Returns the VTPK sprite image, if it exists.

Return type:

QImage

styleDefinition(self) Dict[str, Any][source]

Returns the VTPK style definition.

Return type:

Dict[str, Any]

tileData(self, z: int, x: int, y: int) QByteArray[source]

Returns the raw tile data for the matching tile.

Returns a null byte array if the requested tile does not exist.

Will return an empty byte array (as opposed to a null byte array) if the tile exists but has a zero size.

Parameters:
  • z (int)

  • x (int)

  • y (int)

Return type:

QByteArray