Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[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 )
Loading branch information
Showing
1 changed file
with
15 additions
and
1 deletion .
+15
−1
src/providers/wms/qgswmsprovider.cpp
@@ -1131,7 +1131,15 @@ void QgsWmsProvider::createTileRequestsXYZ( const QgsWmtsTileMatrix* tm, const Q
turl.replace ( " {q}" , _tile2quadkey ( tile.col , tile.row , z ) );
turl.replace ( " {x}" , QString::number ( tile.col ), Qt::CaseInsensitive );
turl.replace ( " {y}" , QString::number ( tile.row ), Qt::CaseInsensitive );
// inverted Y axis
if ( turl.contains ( " {-y}" ) )
{
turl.replace ( " {-y}" , QString::number ( tm ->matrixHeight - tile.row - 1 ), Qt::CaseInsensitive );
}
else
{
turl.replace ( " {y}" , QString::number ( tile.row ), Qt::CaseInsensitive );
}
turl.replace ( " {z}" , QString::number ( z ), Qt::CaseInsensitive );
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*
mapExtent = extent ();
}
if ( mSettings .mXyz )
{
// we are working with XYZ tiles: no legend graphics available
return nullptr ;
}
QUrl url = getLegendGraphicFullURL ( scale, mapExtent );
if ( !url.isValid () )
return nullptr ;
Toggle all file notes