Skip to content

Commit

Permalink
Merge pull request #4569 from boundlessgeo/xyz-inverted-y
Browse files Browse the repository at this point in the history
[bugfix] Fix broken inverted Y support in XYZ layers
  • Loading branch information
elpaso committed May 17, 2017
2 parents d0d6959 + ccd5d75 commit 14ee435
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -1130,7 +1130,15 @@ void QgsWmsProvider::createTileRequestsXYZ( const QgsWmtsTileMatrix *tm, const Q
turl.replace( QLatin1String( "{q}" ), _tile2quadkey( tile.col, tile.row, z ) );

turl.replace( QLatin1String( "{x}" ), QString::number( tile.col ), Qt::CaseInsensitive );
turl.replace( QLatin1String( "{y}" ), QString::number( tile.row ), Qt::CaseInsensitive );
// inverted Y axis
if ( turl.contains( QLatin1String( "{-y}" ) ) )
{
turl.replace( QLatin1String( "{-y}" ), QString::number( tm->matrixHeight - tile.row - 1 ), Qt::CaseInsensitive );
}
else
{
turl.replace( QLatin1String( "{y}" ), QString::number( tile.row ), Qt::CaseInsensitive );
}
turl.replace( QLatin1String( "{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 );
Expand Down Expand Up @@ -3413,6 +3421,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;
Expand Down

0 comments on commit 14ee435

Please sign in to comment.