Skip to content

Commit bb7f95f

Browse files
committed
[bugfix] Fix broken inverted Y support in XYZ layers
This follows the convention used by OpenLayers, where an inverted axis is indicated by {-y} in the URL definition. Fixes #15927 (cherry-picked from ccd5d75)
1 parent 14a8df4 commit bb7f95f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/providers/wms/qgswmsprovider.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -1131,7 +1131,15 @@ void QgsWmsProvider::createTileRequestsXYZ( const QgsWmtsTileMatrix* tm, const Q
11311131
turl.replace( "{q}", _tile2quadkey( tile.col, tile.row, z ) );
11321132

11331133
turl.replace( "{x}", QString::number( tile.col ), Qt::CaseInsensitive );
1134-
turl.replace( "{y}", QString::number( tile.row ), Qt::CaseInsensitive );
1134+
// inverted Y axis
1135+
if ( turl.contains( "{-y}" ) )
1136+
{
1137+
turl.replace( "{-y}" , QString::number( tm->matrixHeight - tile.row - 1 ), Qt::CaseInsensitive );
1138+
}
1139+
else
1140+
{
1141+
turl.replace( "{y}", QString::number( tile.row ), Qt::CaseInsensitive );
1142+
}
11351143
turl.replace( "{z}", QString::number( z ), Qt::CaseInsensitive );
11361144

11371145
QgsDebugMsgLevel( QString( "tileRequest %1 %2/%3 (%4,%5): %6" ).arg( mTileReqNo ).arg( i ).arg( tiles.count() ).arg( tile.row ).arg( tile.col ).arg( turl ), 2 );
@@ -3411,6 +3419,12 @@ QgsImageFetcher* QgsWmsProvider::getLegendGraphicFetcher( const QgsMapSettings*
34113419
mapExtent = extent();
34123420
}
34133421

3422+
if ( mSettings.mXyz )
3423+
{
3424+
// we are working with XYZ tiles: no legend graphics available
3425+
return nullptr;
3426+
}
3427+
34143428
QUrl url = getLegendGraphicFullURL( scale, mapExtent );
34153429
if ( !url.isValid() )
34163430
return nullptr;

0 commit comments

Comments
 (0)