Skip to content

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
ianturton committed Sep 29, 2020
1 parent 878d229 commit d97d11f
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/providers/wms/qgswmsprovider.cpp
Expand Up @@ -3018,30 +3018,21 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPointXY &point, QgsRa
if ( mTileLayer->getFeatureInfoURLs.contains( formatStr ) )
{
// REST


QString url = mTileLayer->getFeatureInfoURLs[ formatStr ];

if (mSettings.mIgnoreGetFeatureInfoUrl)
if ( mSettings.mIgnoreGetFeatureInfoUrl )
{
// rewrite the URL if the one in the capabilities document is incorrect
QString base = mSettings.mBaseUrl;
QgsDebugMsgLevel( QStringLiteral( "1 base=%1" ).arg( base ), 2 );
// strip every thing after the ? from the base url
base = base.split(QRegExp("\\?"))[0];
QgsDebugMsgLevel( QStringLiteral( "2 base=%1" ).arg( base ), 2 );
const QString base = mSettings.mBaseUrl.split( QRegularExpression( "\\?" ) )[0];
// and strip everything before the `rest` element (at least for GeoServer)
QgsDebugMsgLevel( QStringLiteral( "url=%1" ).arg( url ), 2 );
int index = url.length() - url.lastIndexOf("rest") + 1; // +1 for the /
QgsDebugMsgLevel( QStringLiteral( "url=%1" ).arg( url.right(index) ), 2 );


url = base + url.right(index);
QgsDebugMsgLevel( QStringLiteral( "new url=%1" ).arg( url ), 2 );

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 );
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 );
Expand Down

0 comments on commit d97d11f

Please sign in to comment.