Skip to content

Commit dac1289

Browse files
committedOct 27, 2023
Fix loading Google Earth tiles hosted on the cesium ion platform
1 parent 29369d6 commit dac1289

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed
 

‎src/core/tiledscene/qgscesiumtilesdataprovider.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,12 +1004,26 @@ bool QgsCesiumTilesDataProvider::init()
10041004
const QgsNetworkReplyContent content = networkRequest.reply();
10051005
const json tileAccessJson = json::parse( content.content().toStdString() );
10061006

1007-
tileSetUri = QString::fromStdString( tileAccessJson["url"].get<std::string>() );
1007+
if ( tileAccessJson.contains( "url" ) )
1008+
{
1009+
tileSetUri = QString::fromStdString( tileAccessJson["url"].get<std::string>() );
1010+
}
1011+
else if ( tileAccessJson.contains( "options" ) )
1012+
{
1013+
const auto &optionsJson = tileAccessJson["options"];
1014+
if ( optionsJson.contains( "url" ) )
1015+
{
1016+
tileSetUri = QString::fromStdString( optionsJson["url"].get<std::string>() );
1017+
}
1018+
}
10081019

1009-
// The tileset accessToken is NOT the same as the token we use to access the asset details -- ie we can't
1010-
// use the same authentication as we got from the providers auth cfg!
1011-
mHeaders.insert( QStringLiteral( "Authorization" ),
1012-
QStringLiteral( "Bearer %1" ).arg( QString::fromStdString( tileAccessJson["accessToken"].get<std::string>() ) ) );
1020+
if ( tileAccessJson.contains( "accessToken" ) )
1021+
{
1022+
// The tileset accessToken is NOT the same as the token we use to access the asset details -- ie we can't
1023+
// use the same authentication as we got from the providers auth cfg!
1024+
mHeaders.insert( QStringLiteral( "Authorization" ),
1025+
QStringLiteral( "Bearer %1" ).arg( QString::fromStdString( tileAccessJson["accessToken"].get<std::string>() ) ) );
1026+
}
10131027
mAuthCfg.clear();
10141028
}
10151029
}

0 commit comments

Comments
 (0)
Please sign in to comment.