Skip to content

Commit

Permalink
Allow to query larger tiles than the default max size with stepWidth/…
Browse files Browse the repository at this point in the history
…stepHeight in case the WMS does not have a max tile size constraint
  • Loading branch information
mhugent committed Dec 31, 2024
1 parent cd22e7c commit d3b5541
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3850,6 +3850,10 @@ QSize QgsWmsProvider::maximumTileSize() const
{
return QSize( capsMaxWidth, capsMaxHeight );
}
else if( mSettings.mStepWidth > 0 && mSettings.mStepHeight > 0 ) //The chosen step size can be higher than the default max size
{
return QSize( mSettings.mStepWidth, mSettings.mStepHeight );
}
else // default fallback
{
return QgsRasterDataProvider::maximumTileSize();
Expand Down
6 changes: 6 additions & 0 deletions tests/src/providers/testqgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,12 @@ void TestQgsWmsProvider::testMaxTileSize()
const QSize maxTileSize5 = provider5.maximumTileSize();
QCOMPARE( maxTileSize5.width(), 3000 );
QCOMPARE( maxTileSize5.height(), 3000 );

// test that max tile size is set to mStepWidth/mStepHeight if max tile size is not set
QgsWmsProvider provider6( QStringLiteral( "http://localhost:8380/mapserv?xxx&layers=buildings&styles=&format=image/jpg&stepWidth=4000&stepHeight=4000" ), QgsDataProvider::ProviderOptions(), &capabilities);
const QSize maxTileSize6 = provider6.maximumTileSize();
QCOMPARE( maxTileSize6.width(), 4000 );
QCOMPARE( maxTileSize6.height(), 4000 );
}

QGSTEST_MAIN( TestQgsWmsProvider )
Expand Down

0 comments on commit d3b5541

Please sign in to comment.