Skip to content
Permalink
Browse files

[bugfix][server] Respect relations in getfeatureinfo

Fixes #18518

QGIS Server 3 GetFeatureInfo doesn't resolve value relations anymore
  • Loading branch information
elpaso committed Jun 14, 2018
1 parent 365fbed commit eb0be3317829567ef164eff03302e4a3556c17c7
@@ -46,6 +46,7 @@ Most of the time you want to use QgsProject.instance() instead as many component

~QgsProject();


void setTitle( const QString &title );
%Docstring
Sets the project's title.
@@ -382,6 +382,11 @@ QgsProject::~QgsProject()
}
}

void QgsProject::setInstance( QgsProject *project )
{
sProject = project;
}


QgsProject *QgsProject::instance()
{
@@ -109,6 +109,18 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera

~QgsProject() override;

#ifndef SIP_RUN

/**
* Set the current project instance to \a project
*
* \note this is used mainly by the server, which caches the projects and (potentially) needs to switch the current instance on every request
* \see instance()
* \since QGIS 3.2
*/
static void setInstance( QgsProject *project );
#endif

/**
* Sets the project's title.
* \param title new title
@@ -48,7 +48,7 @@ const QgsProject *QgsConfigCache::project( const QString &path )
mFileSystemWatcher.addPath( path );
}
}

QgsProject::setInstance( mProjectCache[ path ] );
return mProjectCache[ path ];
}

@@ -286,6 +286,19 @@ def testGetFeatureInfoFilter(self):
'FEATURE_COUNT=10&FILTER=testlayer%20%C3%A8%C3%A9' + urllib.parse.quote(':"NAME" = \'two\''),
'wms_getfeatureinfo_filter_no_width')

def test_value_relation(self):
"""Test wether value relations are resolved: regression 18518"""
self.wms_request_compare('GetFeatureInfo',
'&BBOX=537912.30469845747575164,4975501.92125043831765652,577227.89428471261635423,4996610.36656293831765652' +
'&CRS=EPSG:32632' +
'&WIDTH=1328&HEIGHT=713' +
'&LAYERS=test_multi' +
'&STYLES=&FORMAT=image/jpeg' +
'&QUERY_LAYERS=test_multi&INFO_FORMAT=text/xml' +
'&I=429&J=528&FEATURE_COUNT=10',
'wms_getfeatureinfo_value_relation',
project='test_project_value_relation.qgz')


if __name__ == '__main__':
unittest.main()

0 comments on commit eb0be33

Please sign in to comment.
You can’t perform that action at this time.