Skip to content


Browse files Browse the repository at this point in the history
Add api to QgsVectorTileRawData to handle situation where
replacement tiles from lower zoom levels have been used, and
where the tile ID to use for the data's clipping region
does not match the tile ID to be used when decoding geometries
  • Loading branch information
nyalldawson committed May 22, 2023
1 parent 981b4a8 commit f5f772f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/core/vectortile/qgsvectortileloader.h
Expand Up @@ -39,10 +39,21 @@ class CORE_EXPORT QgsVectorTileRawData
//! Constructs a raw tile object
QgsVectorTileRawData( QgsTileXYZ tileID = QgsTileXYZ(), const QByteArray &raw = QByteArray() )
: id( tileID ), data( raw ) {}
: id( tileID ), tileGeometryId( tileID ), data( raw ) {}

//! Tile position in tile matrix set
QgsTileXYZ id;

* Tile id associated with the raw tile data.
* This may differ from the tile id in the situation where lower zoom level tiles have been used to replace
* missing higher zoom level tiles. In this case, the tileGeometryId should be used when decoding tiles
* to features in order to obtain correct geometry scaling and placement, while the actual tile id
* should be used when determining the region of the tile for clipping purposes.
QgsTileXYZ tileGeometryId;

//! Raw tile data
QByteArray data;
Expand Down
2 changes: 1 addition & 1 deletion src/core/vectortile/qgsvectortilemvtdecoder.cpp
Expand Up @@ -42,7 +42,7 @@ bool QgsVectorTileMVTDecoder::decode( const QgsVectorTileRawData &rawTileData )
if ( !tile.ParseFromArray(, ) )
return false;

mTileID =;
mTileID = rawTileData.tileGeometryId;

for ( int layerNum = 0; layerNum < tile.layers_size(); layerNum++ )
Expand Down

0 comments on commit f5f772f

Please sign in to comment.