Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #39070 from ianturton/issue-39002
Browse files Browse the repository at this point in the history
1st fix for broken GetFeatureInfo URLs in REST WMTS layers
  • Loading branch information
elpaso committed Oct 10, 2020
2 parents 8eb52c8 + 1bce971 commit 0824eff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -3018,8 +3018,23 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa
if ( mTileLayer->getFeatureInfoURLs.contains( formatStr ) )
{
// REST


QString url = mTileLayer->getFeatureInfoURLs[ formatStr ];

if ( mSettings.mIgnoreGetFeatureInfoUrl )
{
// rewrite the URL if the one in the capabilities document is incorrect
// strip every thing after the ? from the base url
const QStringList parts = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) );
const QString base = parts.isEmpty() ? mSettings.mBaseUrl : parts.first();
// and strip everything before the `rest` element (at least for GeoServer)
const int index = url.length() - url.lastIndexOf( QStringLiteral( "rest" ) ) + 1; // +1 for the /
url = base + url.right( index );
}

QgsDebugMsgLevel( QStringLiteral( "getfeatureinfo: %1" ).arg( url ), 2 );

url.replace( QLatin1String( "{layer}" ), mSettings.mActiveSubLayers[0], Qt::CaseInsensitive );
url.replace( QLatin1String( "{style}" ), mSettings.mActiveSubStyles[0], Qt::CaseInsensitive );
url.replace( QLatin1String( "{tilematrixset}" ), mTileMatrixSet->identifier, Qt::CaseInsensitive );
Expand Down

0 comments on commit 0824eff

Please sign in to comment.