Skip to content
Permalink
Browse files
Amend sprite retrieval
Update url path with resolution and extension rather than appending to string

Fixes #43925
  • Loading branch information
wrass committed Jun 28, 2021
1 parent ae0d37a commit 87decc218db9c8a0d27d2b1b0cf7a94591598dcc
Showing with 6 additions and 4 deletions.
  1. +6 −4 src/core/vectortile/qgsvectortilelayer.cpp
@@ -424,7 +424,9 @@ bool QgsVectorTileLayer::loadDefaultStyle( QString &error, QStringList &warnings

for ( int resolution = 2; resolution > 0; resolution-- )
{
QNetworkRequest request = QNetworkRequest( QUrl( spriteUriBase + QStringLiteral( "%1.json" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) ) );
QUrl spriteUrl = QUrl( spriteUriBase );
spriteUrl.setPath( spriteUrl.path() + QStringLiteral( "%1.json" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) );
QNetworkRequest request = QNetworkRequest( spriteUrl );
QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsVectorTileLayer" ) )
QgsBlockingNetworkRequest networkRequest;
switch ( networkRequest.get( request ) )
@@ -435,10 +437,10 @@ bool QgsVectorTileLayer::loadDefaultStyle( QString &error, QStringList &warnings
const QVariantMap spriteDefinition = QgsJsonUtils::parseJson( content.content() ).toMap();

// retrieve sprite images
QNetworkRequest request = QNetworkRequest( QUrl( spriteUriBase + QStringLiteral( "%1.png" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) ) );

QUrl spriteUrl = QUrl( spriteUriBase );
spriteUrl.setPath( spriteUrl.path() + QStringLiteral( "%1.png" ).arg( resolution > 1 ? QStringLiteral( "@%1x" ).arg( resolution ) : QString() ) );
QNetworkRequest request = QNetworkRequest( spriteUrl );
QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsVectorTileLayer" ) )

QgsBlockingNetworkRequest networkRequest;
switch ( networkRequest.get( request ) )
{

0 comments on commit 87decc2

Please sign in to comment.