diff --git a/src/providers/wms/qgswmsprovider.cpp b/src/providers/wms/qgswmsprovider.cpp index bff0e2cb9319..5ed3fc06bbfe 100644 --- a/src/providers/wms/qgswmsprovider.cpp +++ b/src/providers/wms/qgswmsprovider.cpp @@ -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(); diff --git a/tests/src/providers/testqgswmsprovider.cpp b/tests/src/providers/testqgswmsprovider.cpp index 48ac8fa4df27..21560b337b8b 100644 --- a/tests/src/providers/testqgswmsprovider.cpp +++ b/tests/src/providers/testqgswmsprovider.cpp @@ -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 )