Skip to content

Commit

Permalink
fix unhandled proj exception from vector tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik authored and nyalldawson committed Dec 7, 2020
1 parent 5454bee commit e28ff6f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/core/vectortile/qgsvectortilelayerrenderer.cpp
Expand Up @@ -224,7 +224,16 @@ void QgsVectorTileLayerRenderer::decodeAndDrawTile( const QgsVectorTileRawData &
QgsVectorTileRendererData tile( rawTile.id );
tile.setFields( mPerLayerFields );
tile.setFeatures( decoder.layerFeatures( mPerLayerFields, ct, &mRequiredLayers ) );
tile.setTilePolygon( QgsVectorTileUtils::tilePolygon( rawTile.id, ct, mTileMatrix, ctx.mapToPixel() ) );

try
{
tile.setTilePolygon( QgsVectorTileUtils::tilePolygon( rawTile.id, ct, mTileMatrix, ctx.mapToPixel() ) );
}
catch ( QgsCsException )
{
QgsDebugMsgLevel( QStringLiteral( "Failed to generate tile polygon " ) + rawTile.id.toString(), 2 );
return;
}

mTotalDecodeTime += tLoad.elapsed();

Expand Down
7 changes: 6 additions & 1 deletion src/core/vectortile/qgsvectortileutils.h
Expand Up @@ -51,8 +51,13 @@ class CORE_EXPORT QgsVectorTileUtils
//! Orders tile requests according to the distance from view center (given in tile matrix coords)
static void sortTilesByDistanceFromCenter( QVector<QgsTileXYZ> &tiles, const QPointF &center );

//! Returns polygon (made by four corners of the tile) in screen coordinates
/**
* Returns polygon (made by four corners of the tile) in screen coordinates
*
* \throws QgsCsException
*/
static QPolygon tilePolygon( QgsTileXYZ id, const QgsCoordinateTransform &ct, const QgsTileMatrix &tm, const QgsMapToPixel &mtp );

//! Returns QgsFields instance based on the set of field names
static QgsFields makeQgisFields( QSet<QString> flds );

Expand Down

0 comments on commit e28ff6f

Please sign in to comment.